I am encountering an error when trying to run the code. When I debug, it
stops on the first DoCmd.TransferDatabase line. I have pasted the code
below. What am I doing wrong?
Sub Batch_Import_Macro()
Dim strNextMdb As String
strNextMdb = Dir("P:\ATKINSON\ATKINSON 1 CSRRC SUPPORT\DDA\FINANCIAL
STATEMENT ANALYSIS\2006\TESTING\*.mdb")
Do While strNextMdb <> ""
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "%_Exp_Travel-Staff", "%_Exp_Travel-StaffTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Attendance_Days", "Attendance_DaysTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Contact_Table", "Contact_TableTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "CSLA_Hours", "CSLA_HoursTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Day_Site_Table", "Day_Site_TableTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Expenditure_Table", "Expenditure_TableTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Provider_Table", "Provider_TableTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Reconciliation_Table", "Reconciliation_TableTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Res_CSLA_Site_Table", "Res_CSLA_Site_TableTemp"
DoCmd.TransferDatabase , acLink, , strNextMdb, _
acTable, "Transportation_Table", "Transportation_TableTemp"
CurrentDb.Execute ("%_Exp_Travel-Staff"), dbFailOnError 'Appends the
data
CurrentDb.Execute ("Attendance_Days"), dbFailOnError 'Appends the data
CurrentDb.Execute ("Contact_Table"), dbFailOnError 'Appends the data
CurrentDb.Execute ("CSLA_Hours"), dbFailOnError 'Appends the data
CurrentDb.Execute ("Day_Site_Table"), dbFailOnError 'Appends the data
CurrentDb.Execute ("Expenditure_Table"), dbFailOnError 'Appends the
data
CurrentDb.Execute ("Provider_Table"), dbFailOnError 'Appends the data
CurrentDb.Execute ("Reconciliation_Table"), dbFailOnError 'Appends
the data
CurrentDb.Execute ("Res_CSLA_Site_Table"), dbFailOnError 'Appends
the data
CurrentDb.Execute ("Transportation_Table"), dbFailOnError 'Appends
the data
DoCmd.DeleteObject acTable, "%_Exp_Travel-Staff"
DoCmd.DeleteObject acTable, "Attendance_DaysTemp"
DoCmd.DeleteObject acTable, "Contact_TableTemp"
DoCmd.DeleteObject acTable, "CSLA_HoursTemp"
DoCmd.DeleteObject acTable, "Day_Site_TableTemp"
DoCmd.DeleteObject acTable, "Expenditure_TableTemp"
DoCmd.DeleteObject acTable, "Provider_TableTemp"
DoCmd.DeleteObject acTable, "Reconciliation_TableTemp"
DoCmd.DeleteObject acTable, "Res_CSLA_Site_TableTemp"
DoCmd.DeleteObject acTable, "Transportation_TableTemp"
strNextMdb = Dir()
Loop
End Sub