Beruflich Dokumente
Kultur Dokumente
KEY TERMS
delimited le delimiter xed-width le linked table specication
350
Copyright 2012 John Wiley & Sons
351
You are Yo ar You ar the human resources coordinator at Humongous Insurance, a private com company dedicated to offering products that provide quality protection with va value pricing for rural and low-income families, as well as senior citizens on x xed incomes. Your department has just begun to use Access, but you still x rec receive data in different formats that must be merged with your Access da databases. At times, you also want to distribute information that your manag prefers to view in a different format. In this lesson, you learn how to ager im imp import data, link to an external data source, and save and run import specications. You also learn how to export data from a table and from a query, as well as how to save and run export specications.
To store data from an external source in Access, you can import the d into a new or existing a from an m n Access, cces cc s data database. After you run an import operation, you can save the imp settings for reuse. You import run an import ope u por operation, per mainta can also link to data from an external source without actually maintaining a copy of the data in h d b the database.
352
You can import only one worksheet at a time during an import operation. To import data from multiple worksheets, repeat the import operation for each worksheet. Before you import, you should always review the source data and make any necessary modications, as described in Table 14-1.
Description You cannot import more than 255 source columns, because Access does not support more than 255 elds in a table. It is a good practice to include only the rows and columns that you want to import into the source worksheet or named range. Note that you cannot lter or skip rows during the import operation. If you choose to add the data to an existing table, then you cannot skip columns during the operation either. g p Ensure that the cells are in tabular format. If the worksheet or named range nc ud rang includes merged range inclludes merged cells, the contents of the cell are placed in the nge ud eg eld that corresponds to the leftmost column, and the other elds corresponds to on onds a are left blank. are left blank. l Delete all unnecessary blank columns and blank rows in the Dele e Delete Delete k collumns worksheet work wo wo ksheet or range. If the worksheet or range contains blank cells, wor ksheet rk h try o tr y to add the missing data. If you are planning to append the records r you are o t t to an existing table, ensure that the corresponding eld in the table existing a existing table, ensure that th correspond isti s su sure hat th accepts null (missing unknown) values. accept null (missing or unknown) values. A eld will accept null pts pt nu m n o a el values t v e if its values if its Required eld property is set to No and its ValidationRule d property s ro t r property setting does not prevent nulll values. t ty no not prevent null t If If one or more cells in the worksheet or range contain error values, o n he worksheet h e such # such #NUM d #DIV, su as #NUM and #DIV, correct them before you start the import D them e operation. If a source worksheet or range conta error values, operat ation. If source worksheet or range contains at at rc a Access places null value Access places a null value in the corresponding elds in the table. s l nu corresponding o e To avoid errors during To avoid errors during importing,, ensure that each source column v ro o u ens nsure ns ns e contains contains the same type of data in every row. It is a good practice to o a same am m n every v format format each source column in Excell and assign a specic data format o a Exce xce to each column before you start the import operation, especially if a o each c star t the ar a op column colum co mn includes values of different data types. o different ff ff re If the If the rst row in the worksheet or named range contains the names th wor ksheet or k rang you can of the columns, you can specify that Access treat the data in the y ca an trea rst row as eld names during the import operation. If your source rst row as eld names d oper worksheet worksheet or range does not include the names, it is a good idea kh name to add them to the source before you start the import operation. Note: If you plan to append the data to an existing table, ensure that the name of each column exactly matches the name of the corresponding eld. If the name of a column is different from the name of the corresponding eld in the table, the import operation will fail. To see the names of the elds, open the table in Design View in Access.
Tabular format
First row
Troubleshooting The worksheet should be closed before beginning the import operation. Keeping the
source le open can result in data conversion errors.
353
Troubleshooting After an import operation, you should review the contents and structure of the table
to ensure that everything looks correct before you start using the table. If you see the message An error occurred trying to import le, the import operation failed. If the data imports and you nd just a few missing values, you can add them directly to the table. However, if you nd that entire columns or a large number of values are either missing or were not imported properly, use Access Help to troubleshoot the results and correct the problem in the source le. After you have corrected all known problems, repeat the import operation.
STEP BY STEP
The Humongous le for this lesson is available on the book k companion website or in WileyPLUS.
1. OPEN the Humongous database from the data les for this lesson. 2. SAVE the database as Humongous XXX (where XXX is your initials). X X in 3. On the External Data tab in the Import & Link group, click Excel. The Get External Data tab, n the Data ab, he Exce DataExcel Spreadsheet dialog box appears, as shown in Figure 14-2. DataExcel Spreadsheet dialog box app xce preadsheet dial g c dshe e l ppears, Fig
The New_Employees le for this lesson is available on the book companion website or in WileyPLUS.
4. Click Browse to open the File Open dialog box. 5. Use the Look in box to locate the New_Employees spreadsheet le and then click Open. 6. Notice the three options you have when importing data. Click Import the source data into a new table in the current database and click OK. The Import Spreadsheet Wizard appears, as shown in Figure 14-3.
354
Lesson 14
Figure 14-3
Take Note
On the rst screen of the Import Spreadsheet Wizard, Access also allows y to append a copy he e S Spreadsheet Access also s you of the records to an existing table in the database. Choose Append a copy of the records to the table he records to existing tabl e e ords sting table t n able he database. Choose Append ataba tab hoose ppe o and then select an available table from the drop-down list. then el t the select available table from the drop-down list. ble ab b m the h l t
7. Click Next > to display the next screen, as shown in Figure 14-4. Click l xt to t the h screen, shown Figure w u
8. Click the First Row Contains Column Headings check box. Access uses these column headings to name the elds in the table.
355
10. 10. Click the ZIP column header to display the corresponding eld properties. 0 k e nh header to cor co corresponding eld nd d 11. Click the Data Type down arrow and click Text, as shown in Fig 11. th the Data down arrow w rr r Text, shown Figure 14-6. h
Use the menu to change Use th menu to change the data type e u nge data ty e a type
Take Note
Access reviews the rst eight rows in each column to suggest the data type for the corresponding eld. If the column contains different types of values, the wizard suggests a data type that is compatible with all of the values in the columnusually the text data type. Although you can choose a different data type, values that are not compatible with the chosen data type will be ignored or converted incorrectly during the import process.
356
Lesson 14
12. Click Next > to display the next screen, as shown in Figure 14-7. Figure 14-7 Dene a primary key
13. Click Next > to let Access add the primary key. The nal screen appears, as shown Click Next e Access add he primary ce ce h i The nal screen app h c in Figure 14-8. e 14-8. 4-
14. In the Import to Table box, key New Employees and then click Finish. When the Save Import Steps prompt appears, click Close. 15. In the Navigation pane, double-click the New Employees: Table to open the new table with imported data, as shown in Figure 14-9.
357
Figure 14-9 e New table with imported data d 16. Close the New Employees table. 16. 6. Employees table. e 17. LEAVE the database ope . 17. LEAVE 7 LE E database open ab ab e open. PAUSE. LEAVE Access open to use in the next exercise. exercise. PAUSE. LEA A E EA EAVE s open use in e s xer .
2.5.1 .5.1
How do you import source urce data into a new table? e?
Linking o n Exte nal Data Source Linking to an External Data Source tern te e a S rce 2.5.2 .5.2
How do you append records cords to an existing table? ?
By linking an Access datab e to data in another program, you can us the querying and reporty Access database data another e tabase t no h you o use ing tools that Access provides without havin to maintain a copy of the external data in your Access provides without having maintain i ing es e i ut t ing in n i database. You can also link to other external data sources, such as linkin tables in another Access also other external such linking data database. a h nal na n suc database (although you cannot link to queries, forms, or reports), H or HTML documents, or text database aa cannot link n les. In this exercise, you link to an Excel spreadsheet. you link les. In e u k When you link to an Excel works eet, Access creates a new table that i linked to the source cells, Excel worksheet, creates new is n you o E c w rksh k e called a linked table. The table shows the data in the source worksheet, but it doesnt actually linked abl linked table. The table ble ta in a worksh store the data in the database. Any changes you make to the source c in Excel appear in the cells ta in the database. y changes you a da hang nge linked table. However, you cannot edit the contents or structure of t corresponding table in However, you cannot edit the the e ou anno dit h not no Access. If you want to add, edit, or delete data, you must make the ch changes in the source le.
Take Note
If you dont want to link to the entire worksheet, dene a range that includes only the cells you want to link to. To create a named range, select the cells, right-click, and click Name a Range. In the New Name dialog box, key a name for the range and then click OK. After linking, you should open the linked table and review the elds and data to ensure that you see the correct data in all the elds. If you see error values or incorrect data, use Access Help to troubleshoot the source data and then try linking again.
STEP BY STEP
358
Lesson 14
3. Use the Look in box to locate the Benet_Providers spreadsheet le and then click Open. 4. Click Link to the data source by creating a linked table and click OK. The Link Spreadsheet Wizard appears, as shown in Figure 14-10.
The Benet_ Providers le for this lesson is available on the book companion website or in WileyPLUS. Figure 14-10 Link Spreadsheet Wizard, screen 1
5. Click Next > to display the next screen. Click l display e next screen. ne re 6. Click the First Row Contains Column Headings check box, shown i Figure 14-11, to Click l t w Contains Column Headings nt n ai s l H d box, shown in ox o s use use the rst row data as eld headin in the table. s w data as aa d headings in the e dings h Figure 14-11 1 Link Spreadsheet Wizard, , screen 2
Click Click this check box to use the first row as field headers box the first h r field i
359
9. Click Finish. A Li Spreadsheet Wizard message appears info 9. Click Finish. Li Spreadsheet Wizard message appears informing you that Access F Link p e sheet et s e ppe nished ni e nished linking. 10. 10. Click OK. 0 k OK. K
Troubleshooting If the table with the name you specied already exists, you are asked if you want to ooting f e with t name speci p already exists, r s
overwrite the existing le. Click Yes if you want to overwrite the le; click No to specify a overwrite e exis g le. Click Yes if you wa v is isting k y a overwrite rw different le name. different if name na na e. 11. In the Navigation pane, notice the linked Excel icon next to Benet_Providers. Double11. . Navigatio ation to notice i linked n n next Be click Benet_Providers to open the new linked table, shown in Figure 14-13. Notice c click o open p table, b that there is not an Add New Field column because the structure of a linked table because t that an Add w u structu cannot be changed. changed. can cannot g
360
Lesson 14
12. Click the Close button on Benet_Providers to close the table. 13. OPEN Excel and open the Benet_Providers spreadsheet. 14. Key the new row of data shown in Figure 14-14.
Figure 14-14 New Excel data a 15. Save and close the spreadsheet. 16. CLOSE Excel. 17. In the Navigation pane of Access, double-click Benet_Providers to open the linked Navigation pan of Access, doub e clic tio pane double-click oub Notice that been a in table. Notice th the new row of data has been added, as shown i Figure 14-15. ti h e added, Figure 14-15 5 New Excel data added to o linked table e
New data appears in a linked Access table w ta appears in linked Access table ta ea a nk k c bl
2.5.3
How do you import data as a linked table?
18. Close the Benet_Providers table. Close Benet_Pro t_Providers table. l 19. LEAVE the database open. LEAVE E V PAUSE. LEAVE Access open to use in the next exercise. E. LEAVE open t use in pen pe pe
Saving the details of an import operation as a specication allows you to repeat the operation at import operat o mpor operatio or operation r any time. A specication contains all the information Access needs to repeat an import or speci ion spec catio specication export operation without user i input. Wh you run an i When import wizard, you can save the settings i ih i d you used as a specication so that you can repeat the operation at any time without having to provide any additional input. A specication is exible. For example, you can change the name of the source le or the destination le before you run the specication again. This way, you can use a single specication with several different source or destination les.
Take Note
If you regularly repeat this saved operation, you can create an Outlook task that reminds you when it is time to perform this operation by clicking the Create Outlook Task check box. To use a text le as a source le for importing, the contents of the le must be organized in such a way that the Import Wizard can divide the contents into a set of records (rows) and each record into a collection of elds (columns). Two types of text les that are organized for importing are delimited les and xed-width les. In a delimited le, each record appears on a separate line and the elds are separated by a single character, called the delimiter. The delimiter can be any character that does not appear
Copyright 2012 John Wiley & Sons
361
in the eld values, such as a tab, semicolon, comma, space, and so on. The following is an example of a comma-delimited le: Company Name,Employee Name,Position Fourth Coffee,Dana Burnell,Sales Manager Woodgrove Bank,Michael Emmanuel,Vice President Wingtip Toys,Billie Murray,Owner In a xed-width le, each record appears on a separate line and the width of each eld remains consistent across records. For example, the rst eld of every record is always 9 characters long, the second eld of every record is always 14 characters long, and so on. If the actual character length of a elds value varies from record to record, the values that fall short of the required width must be padded with trailing space characters. The following is an example of xed-width le where the rst eld is said to be 16 characters, second eld is said to be 20 characters and third eld is said to be 14 characters: Company Name Employee name Position Sales Manager Fourth Coffee Dana Burnell Michael Emmanuel Vice Woodgrove Bank Michael Emmanuel Vice President k Michae Emmanuel Vic h Toys Billie Wingtip Toys Billie Murray oy Owner
The Applicants le for this lesson is available able on the book companion ion website or in WileyPLUS. LUS.
1. 1. On the External Data tab, in the Import & Link group, click Text File to open the Get External Data tab, n he Import te a ata b a e p group, click p DataText e dialog box. External DataTe File dialog box. at t Text Te e a o 2. Click Browse to open the File Open dialog box. . to e File l n dialog 3. Use the Look in box to locate the Applicants text le and then click Open. 3. Use U locate o t s e 4. Click Import the source data into a new table in the current database and click OK. The Cli Click e sourc data rc rce a n the h da Import Wizard appears, Impo Text Wizard appears, as shown in Figure 14-16. mpo port a pp s Figure 14-16. u
362
Lesson 14
5. Click Next > to display the next screen, shown in Figure 14-17. Figure 14-17 Import Text Wizard, screen 2
6. Comma should be selected as the delimiter. Click the First Row Co Comm ho Comma should o m selected as e delimiter. el e ed e ck the First h i t Contains Field Names check box o rst ow data as headings the check box to use the rst row data as eld headings in the table. e o st st w a at d g e 7. Click Next > to display the next screen, shown in Figure 14-18, where you can specify Click l xt to t e next screen, n n n 14-18, whe 4 eld e information. eld information. m o Figure 14-18 8 Import Text Wizard, , screen 3
363
9. Click Next > to let Access add the primary key and to display t nal screen, shown 9. k Next ex Access dd the c ss key y to display the Figure in Figure 14-20. g e Figure 14-20 Import Text Wizard, nal screen
364
Lesson 14
10. Click Finish to accept the default table name. A Save Import Steps screen appears. 11. Click the Save import steps check box to display the specication details, shown in Figure 14-21. Figure 14-21 Save Import Steps screen
12. In the Description box, key Import text le with job applicant contact information. Description s pt y Import or with jo applicant cont t o l a 13. Click Save Import. Click l Import. m 14. In the Navigation pane, double-click the Applicants: Table to open t new table with Navigation a n , doub -c k the Applicants: Table to double-click c pp ic l the imported imported data, as shown in Figure 14-22. m a, , s ow shown i Figure 14-22. ur 4-2 u Figure 14-22 2 New table with imported data a
15. Close the Applicants table. 16. LEAVE the database open. PAUSE. LEAVE Access open to use in the next exercise.
365
STEP BY STEP
D Description of specification o
366
Lesson 14
2. Click the le path and edit it by changing the source le name to March Applicants.txt, as shown in Figure 14-24.
3. Click Run. A me sage appears aski if you want to overwrite the e Click l message ap essa appears asking if you want overwrite asking o r existing table, as shown Figure 14-25. shown in Figure 14-25. h r 42 .
4. Click Yes. A message appears conrming that all objects were successfully imported, as shown in Figure 14-26.
o yi
367
Figure 14-27 Table with new imported data d 8. Close the Applicants table. 8. Applicants table. l a s b 9. LEAVE the database open. 9. database open. a b e PAUSE. LEAVE Access open to use in the next exercise. exercise. PA PAUSE. Access cce cc c use he he e
To use Access data in another program, you can use the various comm Access dat ess es data you can use u n commands in the Export group to export the selected object in the format you want. selected obj t in the format you le ted bject l ct d bj ma a
o yi
368
Lesson 14
Destination Workbook Does not exist Source Object Table, query, or form Table or query Exported With or without formatting Without formatting
Data Result Workbook is created during the export operation. The workbook is not overwritten. A new worksheet is added to the workbook and is given the name of the object from which the data is being exported. If a worksheet having that name already exists in the workbook, Access prompts you to either replace y the contents of the corresponding th worksheet or specify another name for spe the new sheet. The workbook is overwritten by the exported data. All existing worksheets exported xp are removed, and a new worksheet are removed, r r having the same name as the exported having av g n object is created. The data in the Excel o e t object T worksheet inherits the format settings of wor ksheet inherit rk h the source object. sou source object ur
Already exists
If the source object is a table or a quer , de e whether you want to ex the h object e table or query, de b bl uery ecide ue ue decide whether want export the data with or a without its formatting. If you choose without formatting, all elds and records in the underlying without formatting. If you choose without formatting, h u i u o th h form fo m elds ds reco object are exported and the Format property settings are ignored during the operation. If you object are c an the Format property settings n h m rt rt e ignored o ed choose with formatting, only the elds and records displayed in the current view are exported records choose with formatting, s ng g elds l re d n curr and the Format property settings are respected. the Format h are respected. You can exp rt a table, query, or form to Excel. You can only export on database object in a export one expo query, form y, , r n only single export operation. However you can merge the data in multiple worksheets in Excel after export operation. However, y or or o wever you ever er, data in aa wo completing the individual export operations. The data is always added in a new worksheet. You data is h n he individual export p ata cannot append the data to an existing worksheet. the data to n existing worksheet. h ta x n orksheet. kh
STEP BY STEP
o yi
369
3. If you want to specify a different destination, click Browse to open the File Save dialog . different e Browse r o box, s Save n box choose choose box, use bo use the Save in box to cho se a folder, and then click Save. o av av x d then Sav 4. Click the Export data with formatting and layout check box and then click the Open the 4. Click the c h data with formatting a o a layout check a o h an destination export destination le after the export operation is complete check box. ti ti r o or is complete e b 5. Click OK. Excel opens and the new worksheet with exported data is displayed, as 5. OK. E Excel and the h worksheet sh shee exported d p shown in Figure 14-29. i Figure i 9 9.
o yi
370
Lesson 14
6. Close the worksheet and CLOSE Excel. 7. Switch to Access. 8. On the Save Export Steps screen, click Close. 9. LEAVE the database open. PAUSE. LEAVE Access open to use in the next exercise.
Pictures or attachments that are part of the source data are not exported to Word. Expressions are not exported either, but the results are. he results are. e esults export fr xp r rom p nt he n the When you export from Access to a Word document, th Export Wizard a document, th always exports formatnd the d s always exported lways ex rted expo t d Wor Word cann ted data and the data is always exported into a new Word le. You cannot append data to an Word document. ment e existing Word document.
STEP BY STEP
3. If you want to specify a different destination, click Browse to open the File Save dialog box, use the Save in box to choose a folder, and then click Save.
o yi
371
4. Click the Open the destination le after the export operation is complete check box. 5. Click OK. Word opens and the new document with exported data is displayed, as shown in Figure 14-31.
Figure 14-31 Word document with t exported data d 6. Close the document and CLOSE Word. 6. e e n CLOSE L 7. Switch to Access. 7. to Access. 8. On the Save Export Steps screen, click Close. 8. Save Export Steps screen, a E rt e t c n Cl Close. 9. LEAVE the database open. 9. e database open. taba b e PAUSE. LEAVE Access open to use in the next exercise. next PAUSE. A Access s use n .
When you perform an export operation, you can save the details for fu n you o an export operation, xp r p save the ve v future use so you can repeat the operation at a later time without having to walk through the step in the wizard each time. operation steps r to r time without ime wa k walk You can even schedule the export operation to run automatically at s operation to run specied intervals by creatn schedu e ched edul ed i n ing an Outlook task. task. s In the Save as box, type a name for the export specication. Optionall type a description in the Optionally, Description box. If you want to perform the operation at xed intervals, such as weekly or monthly, select the Create Outlook Task check box. Doing this creates an Outlook task that lets you run the specication by clicking a button. You can change the name of the specication, its description, and the path and le name of the destination le by clicking and making changes in the text box and then pressing Enter. Repeat an operation by clicking the specication and then clicking Run. If you are exporting data with formatting and layout, you are asked to choose the encoding to be used for saving the le. When the operation is complete, you will see a message that communicates the status of the operation. Although you can export Access data in various formats, sometimes you might need to export data to a program that uses a le format that Access does not support. In that case, if the destination program can use text (*.txt) les, you can export your data in that format and open the resulting le with the second program. When you export the contents of a table or query to a text le with formatting and layout, hyphens (-) and pipe characters (|) are used to organize the content in a grid in the text le. The records appear as rows, elds appear as columns, and eld names appear in the rst row.
o yi o n Wiley & Sons
372
Lesson 14
When exporting without formatting or layout, the Export Wizard gives you the option of creating a delimited le or a xed-width le, as shown in Figure 14-32.
Figure 14-32 Export Text Wizard le options
The choice you make usually dep nds on the system th works with the exported les. If users c i choice u usuall de d n he su lly depe depends he that works r s need to look at the data, a xed-width le can be much easier to read than a delimited le. the xed-width e much easier to d to ok t t d- th h c a
o yi
373
3. If you want to specify a different destination, click Browse to open the File Save dialog box, use the Save in box to choose a folder, and then click Save. 4. Click the Export data with formatting and layout check box and then click the Open the destination le after the export operation is complete check box. 5. Click OK. The Encode New Employees As dialog box is displayed, as shown in Figure 14-34. Figure 14-34 Encode New Employees As dialog box
6. Windows (default) should be selected. Click OK. Notepad open and the new le with opens exported data is displayed, as shown in Figure 14-35.
Figure 14-35 Notepad with exported data d 7. CLOSE Notepad. 7. Notepad. t 8. Switch to Access. 8. o Access. c 9. On the Save Export Steps screen, click the Save export steps c 9. Save Export Steps screen, click the v Exp r po p c en li ic export p r check box to display the shown n Figure specication details, as shown in Figure 14-36. n details, a s ur
o yi
374
Lesson 14
10. In the Description box, key Export new employee information to a text le. 11. Click Save Export. 12. LEAVE the database open. PAUSE. LEAVE Access open to use in the next exercise.
STEP BY STEP
Description of specification
o yi
375
5. Click the le path and edit it by changing the destination le name to New Employees 2.txt, as shown in Figure 14-38.
6. Click Run. Notepad opens and the new le with exported data is displayed, as shown 6. Click opens and n exported xp in Figure 14-39.
Figure 14-39 Notepad with exported data d 7. Switch to Access. A message conrms that the export operation was successful, as Switch Access. m s witch s message the h operatio shown in Figure 14-40. n n Figure
8. Click OK and then click Close to close the Manage Data Tasks dialog box. 9. CLOSE Notepad. 10. CLOSE the database. PAUSE. LEAVE Access open to use in the projects.
o yi
376
Lesson 14
SKILL SUMMARY
In This Lesson You Learned How To: Import Data Exam Objective Import source data into a new table. Append records to an existing table. Import data as a linked table. Objective Number 2.5.1 2.5.2 2.5.3
Save and Run Import Specications Export Data Save and Run Export Specications Specications
1. When you import data, Access creates a(n) When import o Access creates cc cc ea e existing le. existing table without alt ring the source le. x le without altering the source l e it t lter lt in h o t
2. When you link to an Excel worksheet, Access creates a new table, called When h k an Excel worksheet, Access c k e ce s new w a(n) a a(n) , that is linked to the source cells. that s linked to the source n d h contains all the information Access needs to repeat an import or all in o information Access e s 3. A(n) A(n) export without user input. export operation without user input. x o e n le, each record appears on a separate line and the elds are each c separate lin 4. In a(n) a(n a(n) separated by a single character. single character. separat d arate a l a c . is any character that separates elds and does not appear in the s any character c separates arat rate do 5. A(n) values, such tab, comma, or eld values, su as a tab, semicolon, comma, or space. es, es b ma, a rec lin le, each record appears on a separate line and the width of le, each reco d appears record 6. In a(n) consistent each eld remains consistent across records. i t t 7. You can schedule an import or export operation to run automatica at specied 7 automatically task. intervals by creating a(n) 8. When you export the content of a table or query to a text le with and , hyphens (-) and pipe characters (|) are used to organize the content in a grid. 9. When exporting to Excel, the data is always added in a new 10. To repeat an import or export operation, click the specication and then . click .
Multiple Choice
Select the best response for the following statements or questions.
1. Which tab contains options for importing or exporting data? a. Manage Data b. Database Tools c. External Data d. Create
o yi o n Wiley & Sons
377
3. If you want to add, edit, or delete data in a linked table, you must make the changes in the a. First row of data b. Access object c. Field headers d. Source le 4. You can save an import or export operation involving any of the le formats supported in Access, but you cannot save the details of a a. Linking operation b. Text le import operation operation pe peration n c. Query export ope ti y e port operation export peration i d. Fixed-width le Fixed-width ixedxed5. The following is an example of what kind of text Th The following is g example of pl pl text? ext? 1 1, Fourth Coffee, Dana, Burnell, Sales Manager Coff ffee, Burnell, un a. HTML b. Linked b. Linked L ke c. Fixed-width F ed Fixed-width d. Comma-delimited C Comma-delimited m d 6. How many database objects can you expo t in a single export operation? 6. many y objects b t export port po single n e a. One b. Two c. Three d. Unlimited d 7. When you export an object to Word, Access creates what type of le? 7. export p object j Access creates what e a. a. MS-DOS Text b. R b. Rich Text Format Rich Format m c. HTML HT HTM d. Linked Linked k d 8. If you choose to store imported data in a new table, Access to store imported data tore mported da e orte or e a. Links the new table to an existing table b. Overwrites the data in the existing table c. Creates a table and adds the imported data to this table d. Gives you an error message 9. What is an advantage of linking an Access database to data in another program? a. Maintaining a copy of the external data in Access b. Being able to use Access querying and reporting tools c. Being able to edit the linked table in Access d. Easily being able to change the structure of the Access table 10. Which dialog box allows you to manage saved import and export specications? a. External Data b. Saved Specications c. Import/Export Tasks d. Manage Data Tasks
o yi
378
Lesson 14
Competency Assessment
Project 14-1: Import Data from Excel
You are the purchasing manager for Coho Wine Club and an associate has provided some information about champagne and sparkling wines that are being considered for the monthly wine club. The data is in an Excel worksheet and will need to be imported into the database.
GET READY. LAUNCH Access if it is not already running. The Coho Wine Club le for this lesson is available on the book companion website or in WileyPLUS. 1. OPEN the Coho Wine Club database from the data les for this lesson. 2. SAVE the database as Coho Wine Club XXX (where XXX is your initials). 3. On the External Data tab, in the Import & Link group, click Excel to display the Get External DataExcel Spreadsheet dialog box. 4. Click Browse to open the File Open dialog box. g spreadsh 5. Use the Look In box to locate the Champagne_Sparkling spreadsheet le and then click Open. 6. Click Import the source data into a new table in the current database and click OK. t the source he tabl table i ble bl databa Import Spreadsheet appears. The Import Spreadsheet Wizard appears. port o p 7. Click Next > to display the next screen. N Next display the next screen. sp sp a h 8. Click the First Row Contains Column Headings check box. Click the c th Column l ck box. k 9. Click Next > to display the next screen where the wizard prompts y Click l next e wizard ad you to review the eld propert ld properties. d ropert roperties. t 10. Click the Bottled column heading to display the corresponding eld properties. Click the Bottled colum h ic h Bo umn um heading to display n corresponding el r p n 11. Click the Data Type down arrow and click Text. Click e Data i ta t wn arrow and n rro r d 12. Click Next > to display the next screen. Click l t o en next screen. 13. Click Next > to let Access add the primary key. The nal screen appears. Click l l let add primary key. The ey e screen app r 14. In the Import to Table box, key Champagne_Sparkling and then click Finish. When the t t Table box, key Ch mpagne_Sp a o ke Champ e p e_Sparkling and then clic n Save Steps prompt appears, clic Clos Save Import Steps prompt appears, click Close. a t s r m e s click os se. 15. In the Navigation pane, double-click the Champagne_Sparkling: Table to open the new In the Navigation pane double-click the Champagne_Sparkling: Tab o ane, e b k h h par ta table with imported data. te te table imported data. 16. Close the Champagne_Sparkling table. Clos lose s Champagne_Sparkling k g 17. LEAVE the database open for the next project. LEAVE AVE AV AV op n o h open for the LEAVE Access open for the next project. Access c e t ne t ro the next pro roject.
The Champagne_ Sparkling le for this lesson is available on the book companion website or in WileyPLUS.
Project 14-2: Export Data to Word Export Data o Word xport at port or
Your supervisor at Coho Vineyard wants a list of the distributor information in a Word le. Use the Distributor table in the Access database to export the data to a Rich Text Forma le. Format
USE the database that is open from the previous project. 1. In the Navigation pane, select the Distributors: Table. 2. On the External Data tab, in the Export group, click Word to display the ExportRTF File dialog box. 3. If you want to specify a different destination, click Browse to open the File Save dialog box, use the Save in box to choose a folder, and then click Save. 4. Click the Open the destination le after the export operation is complete check box. 5. Click OK. Word opens and the new le with exported data is displayed. 6. Close the le and CLOSE Word. 7. Switch to Access. 8. On the Save Export Steps screen, click Close. 9. CLOSE the database. LEAVE Access open for the next project.
o yi
379
Prociency Assessment
Project 14-3: Save Export Specications
As a travel agent at Margies Travel, a client asks you to email information about the dates for available travel packages. Because you dont know what program the client will use to open it, you export the data to a text le. Because you do this frequently, you decide to save the export operation as a specication that can be used later.
GET READY. LAUNCH Access if it is not already running. The Trip Events le for this lesson is available on the book companion website or in WileyPLUS. 1. OPEN the Trip Events database from the data les for this lesson. 2. SAVE the database as Trip Events XXX (where XXX is your initials). 3. In the Navigation pane, select the 2011 Events: Table. 4. On the External Data tab, in the External group, click Text File to display the ExportText File dialog box. 5. Specify the location where you want to store the le. location where you want tion here u on le. 6. Click the Export data with formatting and layout check box and then click the Open the e Export data E po t formatting and ttin tt n n an destination destination le after the export operation is complete check box. inati n t n s complete b 7. Click OK. The Encode 2011 Events As dialog box is displayed. C ick Click En Encode Events box ox 8. Windows (default) should be selected. Click OK. Notepad open and the new le with . Windows (default) f ld be d No No otepad opens exported displayed. e exported data is displayed. y 9. CLOSE Notepad. . CLOSE Notepad. CLOS CL S ad d 10. Switch Access. 10. Switch to Access. 0 w h s 11. On the Save Export Steps screen, click the Save export steps check box. 11. 1 the Save rt Steps screen, t e e Sav Sa Save export p r c 12. 12. In the Description box, key Export event information to a text le. 2 e Description box, s x Export information to n 13. 13. Click Save Export. 3 Save Export. a 14. LEAVE the database open. 14. 4 the database open. h a s p LEAVE Access open for the next project. LEAVE E s open fo the next project e for xt x r ct ct.
USE the database that is open from the previous project. the da h database that s open ha a pen e previous project. u 1. Open the 2011 Events: Table. he 2011 Events: e2 2. Delete the World Series record from the table. World Series record fr l Se i s ecor fro Seri cord from 3. Close the 2011 Events table. 4. On the External Data tab, in the Export group, click Saved Exports. 5. Click the le path and change the destination le name to 2011 Events updated.txt. 6. Click Run. Notepad opens and the new le with exported data is displayed. 7. Switch to Access. A message conrms that the export operation was successful. 8. Click OK and then click Close to close the Manage Data Tasks dialog box. 9. CLOSE the database. LEAVE Access open for the next project.
o yi
380
Lesson 14
Mastery Assessment
Project 14-5: Export Data to a New Database
You are the manager at Southridge Video. You have created a new database to store information about new video games. You want to export the Games table to the new database. You have exported an Access table to other destinations, but not to another Access database. Use Access Help if you need more information.
GET READY. LAUNCH Access if it is not already running. The Sale Games le for this lesson is available on the book companion website or in WileyPLUS. 1. Create a new le called New Games XXX (where XXX is your initials). 2. CLOSE the New Games database. 3. OPEN Sale Games from the data les for this lesson. 4. Save the database as Sale Games XXX (where XXX is your initials). 5. Use the export skills you have learned in this lesson to export the data and denition d of the Games table to the New Games XXX database. o the New Game h Ne Game Game es X 6. Do not save the export steps. the ex h export 7. OPEN the New Games XXX database to be sure the Games table w successfully he New Games XXX database e e ataba re h re the was exported. exported. rt rte 8. CLOSE both the databases. CLOSE OSE OS d databases. LEAVE Access open for the next project. E Access t project. o
Project 14-6: Appending Data Project 14-6: Appending Data to a Table oj o c 4 n at Tab Table
You are the human resources manager for Contoso, Inc. You have received information about new e the human um n m manager or an o Yo ou rec iv infor ecei e iv ived employees that needs to be imported into the employee database. You already have a table with employees p y t needs n imported into rte nt t t ee da ee database. You information about sales reps, so you want to append the information instead of creating a new table. information om ut le ut sales yo tt th the information instead o o Because you have never appended data before, use Access Help if you need add never appended data b or before, Access you need additional information. Because ca s e d de r A e u
The Contoso Employees le for this lesson is available on the book companion website or in WileyPLUS. The New_Contoso le for this lesson is available on the book companion website or in WileyPLUS. Figure 14-41 1 Appended data
GET READY. LAUNCH Access if it is not already running. T READY. LAUNC Access t NC NCH c s ot l ead ot already running. dy 1. OPEN the Contoso Employees database from the data les for this lesson. OPEN PE Contoso Employees database from os E s ee e as as r les e 2. SAVE the database as Contoso Employees XXX (where XXX is your initials). SA SAVE database s Contoso Employee o ees ee ee X (where XXX you r 3. Choose to import from Excel using the New_Contoso spreadsheet le. Choose hoo l using s o spreadsheet 4. Choose the options necessary to append the spreadsheet data to t Sales Rep table. Choose o e necessary to s r spreadsheet dsh ds the 5. Do not sav the import steps. t save ave import steps. o teps ps. 6. Open the Sales Reps: Table. The data from the Ex Sale Sales ale the Excel spreadsheet sh should be appended to the table, as shown in Figure 14-41 shown in Figure 14-41. ho n Figure 4-41 e 41. 1
o yi
381
INTERNET READY
To display the contents on the Access Help tab, click the File tab and then click the Help tab. The contents of the Access Help tab, shown in Figure 14-42, is where you can contact Microsoft, nd online resources, and the maintain
health and reliability of your Ofce applications. To keep your computer up-to-date, click the Check for Updates button to go to the Microsoft update site. Here you can check to see if you need updates for your programs, hardware, or devices.
o yi