Microsoft KB Archive/208640

= ACC2000: How to Drag Data from Microsoft Excel to a Microsoft Access Database =

Article ID: 208640

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition
 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q208640



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).



SUMMARY
This article shows you how to use the drag-and-drop method to copy data from a Microsoft Excel worksheet to a table in a Microsoft Access database.



MORE INFORMATION
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

When you drag information from Excel to an Access database, be aware of the following data-type conversion issues:
 * Data type Text in Excel appears as data type Text in Access.
 * Data type Number in Excel appears as data type Number in Access.
 * Data type Currency in Excel appears as data type Currency in Access.
 * Data type Time in Excel appears as data type Date/Time in Access.
 * Data type Date in Excel appears as data type Text in Access.

To drag data from an Excel worksheet to a table in an Access database, follow these steps:
 * 1) Open the sample database Northwind.mdb and create a new table in Datasheet view.
 * 2) Start Excel and create a new worksheet. Type the number 1 in cell A1 and type the letter A in cell A2.
 * 3) In Windows 95/98 or Windows NT 4.0, right-click an empty space on the task bar, and then click Tile Windows Vertically (or Horizontally) so that you can see both Access and Excel on the desktop.
 * 4) Select to highlight cells A1:A2 in the Excel worksheet.
 * 5) While holding down the CTRL key, point the mouse pointer at the solid line around the cells that you selected until the mouse pointer becomes an arrow with a plus sign (+). Still holding down the CTRL key, drag the selected cells to the Access table, and then release the mouse button.

NOTE: By holding down the CTRL key during the dragging operation, you ensure that the data is copied from Excel to Access. If you don't hold down the CTRL key, the data is cut from Excel. If you mistakenly cut the data, you can click Undo on the Edit menu in Excel to retrieve the data.
 * 1) When you release the mouse button to drop the data onto the table, the title of the Access table begins to flash. This happens because the program is waiting for your response. Click anywhere in the Access table. Note that you receive a message that states that you are about to paste two records into the table. Click Yes to confirm that you want to paste the two records.

Note that the two records are pasted into Field1 of the table. To paste data into a table field other than Field1, select the fields in the table where you want the data to be placed before you start to drag the cells from Excel. If you select only one table field, only the first column in the selection from Excel is pasted. If you try to repeat this and paste the second column into Field2, Access appends the data as new records rather than adding the data to the existing records. Access is designed this way because it is a relational database program and does not behave in the same manner as a spreadsheet program.

Keywords: kbhowto kbinterop KB208640

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.