Adding query reults to a specified table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top