D
Dynath
What I am trying to do is take a large number of entries spread out in some 5
or 6 thousand databases stored in one folder, and put that data into a single
Table in my primary database. I've gotten as far as getting the form to
collect the data from the Databases and then it adds them in tables named
"Name, Name1, Name2, Etc." Can anyone tell me what I'm doing wrong? I
assume its something wrong with the Syntax of the DoCmd.TransferDatabase
comand at the end. Basically the form this goes in should ask me for a
location where the Databases are then ask me for a table name, and then just
append the data from the databases to the table, creating the table if needed.
Private Sub Command0_Click()
Dim InputDir, ImportFile As String
Dim tblName, Tableloc As String
Dim InputMsg As String
Dim PromMsg As String
InputMsg = "Type the pathname of the folder that contains "
InputMsg = InputMsg & "the files you want to import."
PromMsg = "type the table name to Append files To."
InputDir = InputBox(InputMsg)
Tableloc = InputBox(PromMsg)
' Change the file extension on the next line for the
' type of file you want to import.
ImportFile = Dir(InputDir & "\*.dbf")
Do While Len(ImportFile) > 0
' Use the import file name without its extension as the table
' name.
tblName = Tableloc
'tblName = Left(ImportFile, (InStr(1, ImportFile, ".") - 1))'
' Change dBase III on the next line to the type of file you
' want to import.
DoCmd.TransferDatabase acImport, "dBase III", InputDir, _
acTable, ImportFile, tblName
ImportFile = Dir
Loop
End Sub
or 6 thousand databases stored in one folder, and put that data into a single
Table in my primary database. I've gotten as far as getting the form to
collect the data from the Databases and then it adds them in tables named
"Name, Name1, Name2, Etc." Can anyone tell me what I'm doing wrong? I
assume its something wrong with the Syntax of the DoCmd.TransferDatabase
comand at the end. Basically the form this goes in should ask me for a
location where the Databases are then ask me for a table name, and then just
append the data from the databases to the table, creating the table if needed.
Private Sub Command0_Click()
Dim InputDir, ImportFile As String
Dim tblName, Tableloc As String
Dim InputMsg As String
Dim PromMsg As String
InputMsg = "Type the pathname of the folder that contains "
InputMsg = InputMsg & "the files you want to import."
PromMsg = "type the table name to Append files To."
InputDir = InputBox(InputMsg)
Tableloc = InputBox(PromMsg)
' Change the file extension on the next line for the
' type of file you want to import.
ImportFile = Dir(InputDir & "\*.dbf")
Do While Len(ImportFile) > 0
' Use the import file name without its extension as the table
' name.
tblName = Tableloc
'tblName = Left(ImportFile, (InStr(1, ImportFile, ".") - 1))'
' Change dBase III on the next line to the type of file you
' want to import.
DoCmd.TransferDatabase acImport, "dBase III", InputDir, _
acTable, ImportFile, tblName
ImportFile = Dir
Loop
End Sub