importing dbf files

Icehousman2

Registered User.
Local time
Yesterday, 21:07
Joined
May 12, 2004
Messages
45
When I am importing .dbf files into access to create a new table I want to be able to replace old tables with the same name. I can do this when importing an excel file to create a table, but when Importing a .dbf if a table exists with the same name access renames the new table. For example if I import a file named market and a table named market already exists, access creates a new table called market1. I need to be able to import the .dbf file and automatically replace the old one, so there is only one table in the database. Is this possible to do with dbf files.
 
This is an extract from the help file for the Transferdatabase Action:
"If you select Import in the Transfer Type argument and Table in the Object Type argument, Access creates a new table containing the data in the imported table.

If you import a table or other object, Access adds a number to the name if it conflicts with an existing name. For example, if you import Employees and Employees already exists, Access renames the imported table or other object Employees1.

If you export to an Access database or another database, Access automatically replaces any existing table or other object that has the same name."

It seems to me that you could either write some code to rename the tables after import and delete the unwanted ones OR import to a holding database and then immediately export to the permanent database, thus automatically renaming the tables in question.
 
I am semi-familiar with VBA, and could probably write code that does what you talked about. But where do I put the code so that it will execute when I am importing the new table. Thanks for the advice.
 
One way would be to have a command button on your main switchboard (assuming you have one). The OnClick of the button would call a module which you would imaginatively name as IMPORT.

IMPORT would first delete the old data in your holding database, import the new data, then re-export it to your permanent database. Very little code is required, you simply have to automate the process by entering the required sequence of events. If it would help you, I may be able to track down an import routine I wrote in Access97 some time ago.
 
If you can spare the time that would be great. Thanks for the help, It is appreciated.
 
Please !

cogent1 said:
One way would be to have a command button on your main switchboard (assuming you have one). The OnClick of the button would call a module which you would imaginatively name as IMPORT.

IMPORT would first delete the old data in your holding database, import the new data, then re-export it to your permanent database. Very little code is required, you simply have to automate the process by entering the required sequence of events. If it would help you, I may be able to track down an import routine I wrote in Access97 some time ago.

Could I get a copy of this code as well? I hate rewriting something that you've already written !
Marty H.
 

Users who are viewing this thread

Back
Top Bottom