Adding query reults to a specified table

R

Robert

I want to know if it is possible to run a query (via a form) and send the
results of that query to a specified table? Thanks.
 
B

Brendan Reynolds

Sure. It's called an append query. In the example that follows I've used a
SQL string embedded in the code, just to show both the code and the SQL at
the same time. To execute a saved append query, just replace the SQL string
with the name of the query.

Private Sub cmdTest_Click()

Dim strSQL As String

strSQL = "INSERT INTO tblTarget ( TargetText, TargetNum ) " & _
"SELECT tblSource.SourceText, tblSource.SourceNum FROM tblSource;"
CurrentDb.Execute strSQL, dbFailOnError

End Sub
 
Top