Sie sind auf Seite 1von 8

BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 1 of 8

MS ACCESS 2003

SHARING DATA

Sharing Data

Background Reading
Why is it important for a database to be able to share data with other programs?
A DBMS (database management system) such as Microsoft Access is made for storing and analyzing
data. However, the data kept in Access is often needed in other programs. A word processor, for
example, may need it to create documents and presentations, a spreadsheet may need it for advanced
numerical analysis, a Web browser may need to display it from the Internet, and so on. A good database
program, therefore, must be able to import and export data in a variety of formats.
Access has this capability.

For a complete list of file formats that Access can import and
export, go to Help and search for import data and export data.
The exercises below give you practice the following import/export options of Access.
• import data from Excel (no field titles)
• import data from Excel (with field titles)
• export data to Excel
• export data to a Word table
• import data from / export data to a delimited text file

Ex. 1 Import data from an Excel worksheet (with no field titles)


1. In Excel create a worksheet as below.

Notice that it looks similar to a table in Access but without field names (in Excel this kind of database
is called a list).
2. Save the file as ClassicalCDs.xls.
3. Start Access and create a new database named ClassicalCds.mdb.
4. Select File / Get External Data.
5. Click on Import. The Import dialog box opens.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 1 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 2 of 8

MS ACCESS 2003

SHARING DATA

6. Select / Files of type: Microsoft Excel.

7. Navigate to the appropriate folder. Select ClassicalCDs.xls.


8. Select the default, Sheet1.
9. Click on Next three more times to accept the defaults. Work slowly and read each dialog box so
that you understand your choices.
• First row does not contain column headings.
• Store your data in a new table.
• Field options
10. Select No primary key.

11. Click on Next.


12. Name the table CDs.
13. Click on Finish.
14. Double-click on the CDs table to open it.
15. Select View / Design View.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 2 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 3 of 8

MS ACCESS 2003

SHARING DATA

16. in Design View. Rename the Field1 column heading Title and change the Field Size to 40.
Rename and adjust the other column headings as follows: Recording Company (Field Size 30),
Composer (Field Size 30), Artist (Field Size 30), Price (Data Type: Currency).

17. Save the table.


18. Click Yes on the warning box entitled Some data may be lost.

Access is warning you that you have reduced the size of some fields from 255 to 40 characters. It
would cut off all data in those fields after the 40th character. You can click on Yes because your data
fits easily into the 40-character limit.
19. Select View / Datasheet View.
20. Adjust the column widths so that all the data can be seen.
21. Save and close the table.

Ex. 2 Import data from an Excel worksheet (with field titles)


1. Open the Excel file ClassicalCDs.xls.
2. Add titles as below, and save as ClassicalCDs2.xls.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 3 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 4 of 8

MS ACCESS 2003

SHARING DATA

3. Use the procedures above to import ClassicalCDs2.xls into ClassicalCDs2.mdb.as a table named
CDs2 with one difference — be sure to select the option First Row Contains Column Headings.

4. Save the table.

Note: Some Excel worksheets/lists will require editing before importing into Access.
For example, if there are several top rows with different kinds of titles, some rows might have to be
deleted to leave just the one set of titles you want.

Ex. 3 Export data from Access to Excel (Copy/Paste)


1. Keep the ClassicalCDs2.mdb database open showing the table CDs2.
2. Open a new Excel file.
3. Select the data in the table CDs2, copy and paste into Excel. (You do not have to save the Excel
file. It is enough to see how the process works.)

Ex. 4 Export data from Access to a Word table (Copy/Paste)


1. With ClassicalCDs2.mdb still open showing the table CDs2, open a new Word file.
2. Select the data in the table CDs2, copy and paste into Word. (You do not have to save the Word
file.)

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 4 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 5 of 8

MS ACCESS 2003

SHARING DATA

Ex. 5 Importing data from a delimited text file


The simplest form of a database is the delimited text file, consisting of text-only (ASCII) characters.
Because of its extreme simplicity, the delimited text file is the most portable of database formats; that is,
every database program can read delimited database files, and every database program can write
delimited database files. Delimited text files are also useful in that they can be emailed easily without the
use of attachments, they can be posted on a webpage, they can be greatly compressed (e.g. in.zip or .rar
formats), etc.
The delimited text file supports only the fields and records of a database. More advanced database
features are not supported.
The example below shows data not quite yet in delimited format. Notice that the contents are similar to a
database table. The top line indicates field names. Below that are 4 records, each record starting on a
new line. In other words, the carriage return ¶ at the end of the first line indicates the end of the field
names, and the carriage return at the end of the other lines indicated the end of a record.

Title Author Publisher Price¶


Business English: A Complete Guide Andrea B. Geffner Barron's Educational Series, Incorporated $17.95¶
Writing Business Letters For Dummies Sheryl Lindsell-Roberts John Wiley & Sons $27.99¶

The example below shows the same data in comma-delimited format. Field contents are placed
between quotation marks and separated by commas. The comma is called the delimiter. (Other common
delimiters are tabs and semi-colons.) Notice that there is no space before and after each comma.

"Title","Author","Publisher","Price"¶
"Business English: A Complete Guide","Andrea B. Geffner","Barron's Educational Series, Incorporated","$17.95"¶
"Writing Business Letters For Dummies","Sheryl Lindsell-Roberts","John Wiley & Sons"," $27.99"¶

1. Copy the above text (you will find it at from http://schools.tdsb.on.ca/jarvisci/commaDB.txt), paste
into Notepad.
2. Save as a text file named commaDB.txt.
3. Create a new Access database named commaDB.mdb.
4. Use what you know about importing an Excel file to begin importing the comma-delimited file
commDB.txt into Access. Read each of the screens carefully while you work.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 5 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 6 of 8

MS ACCESS 2003

SHARING DATA

5. When navigating to find your delimited file, commaDB.txt, be sure to select File Type: Text Files
(.*txt, *.csv, *.tab, *.asc).

6. Notice that the Import Text Wizard recognizes that the file is delimited.

7. It also recognizes that the file is comma-delimited (not tab-, semi-colon-, or space-delimited).

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 6 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 7 of 8

MS ACCESS 2003

SHARING DATA

8. Click on First Row Contains Field Names.

9. Name the table commaDB.

Ex. 6 Exporting data to a delimited text file


1. Add data into the Access table commaDB for the following 3 books.

Title Author Publisher Price

Solution Selling Michael Bosworth Irwin Professional Publishing $47.95

E-commerce: Business On The Internet Bruce McLaren Thomson Learning $63.74

Readings in Electronic Commerce Ravi Kalakota Addison Wesley Professional $56.75

2. Export the table as a semicolon-delimited text file named commaDBplus3.txt with field names on
the first row (File / Export / Save As: text file . . .etc.)
3. Open the file in Notepad. Below the data add your name, BTA301, your period and your teacher’s
name. Save the file.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 7 of 8
BTA3O1 – Productivity Software – Unit 3: Database – Part 2: Sharing Data– Page 8 of 8

MS ACCESS 2003

SHARING DATA

Ex. 6 Exporting data to a delimited text file


1. Add data into the Access table commaDB for the following 3 books:

Title Author Publisher Price

Solution Selling Michael Bosworth Irwin Professional Publishing $47.95

E-commerce: Business On The Internet Bruce McLaren Thomson Learning $63.74

Readings in Electronic Commerce Ravi Kalakota Addison Wesley Professional $56.75

The procedure for exporting a delimited text file will be quite straightforward now that you have learned
the procedures for importing a delimited text file.
2. Export the table as a semicolon-delimited text file named commaDBplus3.txt with field names on
the first row (File / Export / Save As: text file . . .etc.)
3. Open the file in Notepad. Below the data add your name, BTA3O1, your period and your
teacher’s name. (On a test you might be asked to print a file like this one.)

"Business English: A Complete Guide";"Andrea B. Geffner";"Barron's Educational Series, Incorporated";"$17.95"


"Writing Business Letters For Dummies";"Sheryl Lindsell-Roberts";"John Wiley & Sons";" $27.99"
"Solution Selling";"Michael Bosworth";"Irwin Professional Publishing";"$47.95"
"E-commerce: Business On The Internet";"Bruce McLaren";"Thomson Learning";"$63.74"
"Readings in Electronic Commerce";"Ravi Kalakota";"Addison Wesley Professional";"$56.75"

4. Save the file.

BTA3O1 Information and Communication Technology: The Digital Environment- Productivity Software
Unit 3: Database – Part 2: Sharing Data– Page 8 of 8

Das könnte Ihnen auch gefallen