Hi Experts,
I have a form bounded to a temporary table (only for bulk data entry). When click on a button, I am trying to INSERT records If those are Not Exists in a table.
This is what I tried.
Code:
Dim MyDate As Date
Dim MyNo As Long
Dim MyRec As Long
Dim strSQL As String
MyDate = Dlookup(“DateID”,”tblTemp”)
MyNo = Dlookup(“NoID”,”tblTemp”)
MyRec = Dlookup(“RecID”,”tblTemp”)
strSQL = "INSERT INTO tblAct (DateID, NoID, RecID)" & _
"VALUES (#" & MyDate & "#, " & MyNo & ", " & MyRec & ")" & _
"ON DUPLICATE KEY UPDATE [DateID] = [DateID];"
If Me.Dirty Then
Me.Dirty = False
End If
CurrentDb.Execute strSQL, dbFailOnError
But this is not working. Giving error 'Run Time Error 3137' "Missing semicolon (; ) at end of SQL statement.
MyDate, MyNo & MyRec are getting the first value from a field.
Thank you for your time.