Hey, I'm trying to create a code which selects some records from one table and posts them into another. I'm a complete beginner at this but I've managed to get this far:
Private Sub Command83_Click()
Dim strSQL As String
Dim strCriteria As String
strSQL = ""
strSQL = strSQL & " INSERT INTO Table"
strSQL = strSQL & " SELECT ([Merchant Name],[Merchant Type],[Partner],[Merchant Sector])"
strSQL = strSQL & " FROM Table![Main table]"
strSQL = strSQL & " WHERE (((Table) IN ' & 1-5000 & ' AND ((Table) IN ' & 1-5000 & ')));"
DoCmd.RunSQL strSQL
End Sub
The trouble is that Access has a problem with the last line of code and I can't figure out for the life of me why this is. Does anyone have any ideas?
Private Sub Command83_Click()
Dim strSQL As String
Dim strCriteria As String
strSQL = ""
strSQL = strSQL & " INSERT INTO Table"
strSQL = strSQL & " SELECT ([Merchant Name],[Merchant Type],[Partner],[Merchant Sector])"
strSQL = strSQL & " FROM Table![Main table]"
strSQL = strSQL & " WHERE (((Table) IN ' & 1-5000 & ' AND ((Table) IN ' & 1-5000 & ')));"
DoCmd.RunSQL strSQL
End Sub
The trouble is that Access has a problem with the last line of code and I can't figure out for the life of me why this is. Does anyone have any ideas?