Hello experts. I am trying to create a sub procedure in VBA that will take the value of a date field in one table and add that date to the date field in another table. (Access 2003 database). I keep getting an error that says "Syntax error in INSERT INTO statement" When I debug it takes me to the line in my code "cnCurrent.Execute strSQL". Any ideas? Here is the code in the sub:
Private Sub UpdateDate()
Dim cnCurrent As ADODB.Connection
Dim strSQL As String
Set cnCurrent = CurrentProject.Connection
strSQL = "INSERT INTO tblDate ( Date ) " & _
"SELECT tblTempDate.Date FROM tblTempDate " & _
"GROUP BY tblTempDate.Date"
cnCurrent.Execute strSQL
cnCurrent.Close
Set cnCurrent = Nothing
txtLastDate.Requery
End Sub
Thanks!
~rasta2212
Start Free Trial