PDA

View Full Version : Appending Array Tables in Access with VBA



ekryez
03-25-2014, 04:54 PM
I have to append 120 tables into master table
I get runtime error. Please Help

Private Sub Append_Click()
Dim aryTables As Variant
aryTables = Array("project brd", "project udr")
For K = LBound(aryTables) To UBound(aryTables)
db.Execute "INSERT INTO master " _
& "SELECT ID, Region, Country, ProjectName, " _
& "ProjectNumber, Coordinates, BusinessDeveloper " _
& "FROM [" & aryTables(K) & "]", dbFailOnError
MsgBox db.RecordsAffected & " from table " & aryTables(K) & " were added to the master table."
Next K
End Sub

Run-Time error '424'
Object Required

jonh
03-26-2014, 05:48 AM
What's db set to?