simple sql not so simple

crich21

Registered User.
Local time
Today, 01:37
Joined
Jan 10, 2003
Messages
86
Can someone please help

I am using windows 7 64 bit with Access xp.

I am getting and error 3134 from the following code.

Code:
Private Sub Form_AfterInsert()
    Dim strsql As String

   On Error GoTo Form_AfterInsert_Error

    strsql = "INSERT INTO tblOptions (CategoryID, Option)" & _
             " VALUES(" & Chr(34) & "1326836054" & Chr(34) & "," & SQLFormat(Me.Package) & ")"
    
    Debug.Print strsql
'    CurrentDb.Execute strsql, dbFailOnError

   On Error GoTo 0
   Exit Sub

Form_AfterInsert_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_AfterInsert of VBA Document Form_frmPackage"
End Sub
 
Create a query that shows the desired results, then view the sql and see what is different.
 
No idea why, but I had to add brackets around the fieldnames
 

Users who are viewing this thread

Back
Top Bottom