So, I'm learning Access 2007, Visual Basic, and SQL at the same time. Not ideal.
I have this code attached to a button in a standard wizard-generated interface. I'm trying to copy a line from tblA to tblB. Every time the code is executed I get the message, "Run-time error '3137' Missing semicolon (;) at end of SQL statement."
I'm guessing that it's expecting the SQL statement to terminate earlier, before the WHERE? But without the WHERE, how would I attach the add to a particular line ID?
Private Sub buttonAdd_Click()
Dim strSQL As String
strSQL = "INSERT INTO [tblB]" & _
"VALUES (ID, [Name], [Some value], [Some other value])" & _
"SELECT * FROM tblA" & _
"WHERE ID = '" & Me.ID & "' " & _
";"
DoCmd.RunSQL strSQL
End Sub