D
DaveK
Guest
Hi,
I have a question regarding import of multiple dbf files.
These files all have different names but will always be found in the same location.
C:\Documents and Settings\computer\Desktop\F FILES
I have little VBA knowledge and am wondering if I can import ALL these files into an existing Access table FORMGUIDE via a macro?
This is what I have so far to import one file:
Option Compare Database
'------------------------------------------------------------
' Import
'
'------------------------------------------------------------
Function Import()
On Error GoTo Import_Err
DoCmd.TransferDatabase acImport, "dBase 5.0", "C:\Documents and Settings\computer\Desktop\F FILES\", acTable, "ASC0128F.DBF", "tblFORMGUIDE", False
Import_Exit:
Exit Function
Import_Err:
MsgBox Error$
Resume Import_Exit
End Function
A number of problems:
1. It does not import directly into the existing table, instead it creates a new table tblFORMGUIDE1, I'd like to import directly into the existing table without using append or similar.
2. I cannot get it to import ALL files in the folder.
3. I'd like to import the first 7 characters of the filename into a field (KEY).
I've already read the Knowledgebase and found the Batch Import, but this does not help as you have to manually enter the name of each file and I have over 2,500 individual dbf files.
Any help or examples would be greatly appreciated.
Thanks.
I have a question regarding import of multiple dbf files.
These files all have different names but will always be found in the same location.
C:\Documents and Settings\computer\Desktop\F FILES
I have little VBA knowledge and am wondering if I can import ALL these files into an existing Access table FORMGUIDE via a macro?
This is what I have so far to import one file:
Option Compare Database
'------------------------------------------------------------
' Import
'
'------------------------------------------------------------
Function Import()
On Error GoTo Import_Err
DoCmd.TransferDatabase acImport, "dBase 5.0", "C:\Documents and Settings\computer\Desktop\F FILES\", acTable, "ASC0128F.DBF", "tblFORMGUIDE", False
Import_Exit:
Exit Function
Import_Err:
MsgBox Error$
Resume Import_Exit
End Function
A number of problems:
1. It does not import directly into the existing table, instead it creates a new table tblFORMGUIDE1, I'd like to import directly into the existing table without using append or similar.
2. I cannot get it to import ALL files in the folder.
3. I'd like to import the first 7 characters of the filename into a field (KEY).
I've already read the Knowledgebase and found the Batch Import, but this does not help as you have to manually enter the name of each file and I have over 2,500 individual dbf files.
Any help or examples would be greatly appreciated.
Thanks.