Hi Micron
Yes, you can do an INSERT query like that.
I agree with you completely about linking the source table(s) from the other database.
@Day4
The generalised version which I've just tested is:
Code:
DoCmd.RunSQL "INSERT INTO newTable SELECT * FROM " & tblName & " IN '" & dbPath & "'"
or use CurrentDb.Execute
In either case, it should run without error
However, do bear in mind that this code will allow you to repeatedly append the same data, so I recommend you empty the destination table first:
Code:
CurrentDb.Execute "DELETE * FROM newTable;", dbFailOnError
CurrentDb.Execute "INSERT INTO newTable SELECT * FROM " & tblName & " IN '" & dbPath & "';", dbFailOnError
However if you link the source table(s) as recommended above, the IN part of the query is no longer needed.
Make use of linked tables wherever possible. It makes coding much easier & there are no drawbacks!