Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Multiple "dbf" files into a Access97 Table 2

Status
Not open for further replies.

Homma

Technical User
Apr 9, 2001
6
0
0
AU
Hi,

My name is Adam. I trying to determine if there is anyone out there can help me with an easy solution to my problem.

I have been asked to collate some 3000 plus *.dbf files (each named differently) into a/1 Access'97 table. When individually importing a "dbf" file into Access, there is only 1 table (which only has 1 row) I only need from each "dbf" file. The table is the same name throughout each of the "dbf" files.

Has anyone come across something simular to this in their tracks and has a solution.

The only I can seem to bring in the data is doing each file individually.

Cheers
Adam X-)
 
I cannot understand very well what you ask, so tell me more.
Here it is a code that helps you to see every .dbf from a directory.

Dim MyName As String

MyName = Dir("C:\Fact2\*.DBF", vbNormal)
Do While MyName <> &quot;&quot;
............
MsgBox MyName
............
MyName = Dir
Loop
 
Many Thanks for yor time in this matter. Your sample helps!

What I'm trying to accomplished is to pick up a specific table from within each of the &quot;dbf&quot; files into Access'97. (Each of the &quot;dbf&quot; files are named differently)

I know that if I write a macro using &quot;TranferDatabase&quot; as the command, it will let me pick up the table but I would have to change it for each &quot;dbf&quot; file. I need to do this for 3000+ files.

From the sample code you advised, can it be expanded to import the table from each &quot;dbf&quot; file? I have tested it and I can see each &quot;dbf&quot; file and it's name.
 
Instead of using the TranferDatabase Action in a macro, use the TransferDatbase method of DoCmd in VBA code. You can use code to read the directory, find the file names and process each one with Tranferdatabase.

Check this link for an article that explains how to import all files in a directory.

ACC: How to Automate Importing All Files in a Specific Folder
Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top