Import Macro

Dukelewis

Registered User.
Local time
Today, 19:34
Joined
Nov 2, 2000
Messages
11
I need an import macro that could import an Excel file as an Access table. The macro needs to specify the top row as a header and be able to name a primary key column. Any help on this would be greatly appreciated. Thanks!

[This message has been edited by Dukelewis (edited 11-17-2000).]
 
I do that quite a bit, too. The way I've handled it is to first import the table manually through the New Table dialogue. Then, I set the field properties for the table (which is where you can set the Prime Key). Next,I create the queries I need to clean up the data and/or append the data to existing tables. Finally, I delete all the data in the table (but leave the structure in tact). Now, I'll create the Macro to handle the automated import. Choose the TransferSpreadsheet action, then specify Import for the transfer type, the Excel version for Spreadsheet Type, the Table Name you are importing the spreadsheet to (the manually created table), the exact path to the file in File Name, and the range within the excel spreadsheet (if you're only importing a specific range within the worksheet; if not, leave this blank). To retain the Excel headers, select Yes under Has Field Names (make sure you used those exact field names when you designed the table during manual import). After the TransferSpreadsheet action, you can add other actions to run the queries that clean up or append data.

Hope that helps!

[This message has been edited by brucesilvers (edited 11-17-2000).]
 
Thanks for the help. Your procedure works great!
 

Users who are viewing this thread

Back
Top Bottom