Full Version: Importing data into a table
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
kckmex
Is there a way to create a macro or command to import data. I currently go to file, get external data and start the import wizard. Is there a way through a command button to go directly to the import wizard.

Kevin
freakazeud
Hi,
you can automate the whole process. Depending on what data you are trying to import you can use one of the following:
TransferDatabase method
TransferSpreadsheet method
TransferText method
If you clarify a little more what your import data looks like (format) then we can help you further with sample syntax or suggestions.
Furthermore, it is always recommended to first import into a new blank temp table and then use append queries to append the formated data to the tables of your choice. You can always drop the temp tables afterwards if you want.
HTH
Good luck
kckmex
I am importing the date form an excel spreadsheet.
freakazeud
So the transferspreadsheet method is what you would want to use.
HTH
Good luck
kckmex
Is there anyway to create a command box to open the import wizard?
freakazeud
You don't need the import wizard...the transferspreadsheet will do everything for you...if you want the user to select a file then use this code and pass the returned full string path to the filename argument of the transferspreadsheet method. You might find this lengthy but informative discussion helpful...it is the exact scenario, but only using transfertext to import a text file...use the transferspreadsheet method in that part.
HTH
Good luck
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.