Sub GetSpecs()
Dim accApp As Object
Dim SourceDBName As String
Dim DbPath As String
Dim CurrDB As String
SourceDBName = "C:\SourceDB.mdb"
DbPath = "C:\TargetDBPath\" 'Make sure about last slash
Set accApp = CreateObject("Access.Application")
CurrDB = Dir(DbPath & "*.mdb", vbNormal)
Do Until Len(CurrDB) = 0
If Not DbPath & CurrDB = SourceDBName Then
accApp.OpenCurrentDatabase DbPath & CurrDB
On Error GoTo errhandler
accApp.CurrentDb.TableDefs.Delete "MSysIMEXSpecs"
accApp.DoCmd.TransferDatabase acImport, "Microsoft Access", SourceDBName, acTable, "MSysIMEXSpecs", "MSysIMEXSpecs"
accApp.CloseCurrentDatabase
CurrDB = Dir()
End If
Loop
accApp.Quit
MsgBox "Done", vbOKOnly + vbInformation, "Error"
Exit Sub
errhandler:
If Err = 3265 Then
Resume Next
Else
MsgBox Err & " - " & Err.Description, vbOKOnly + vbExclamation, "Error"
If Not accApp Is Nothing Then accApp.Quit
End If
End Sub