Start New Discussion within our Software Development Community

Please help, I am trying to insert but it is saying syntax error

  con.Execute ("INSERT INTO Contacts VALUES('" & lblRecordID.Caption & "', " & Replace(UserID, "'", "''") & ",'" & Replace(txtfolio.Text, "'", "''") & "','" & Replace(txtsname.Text, "'", "''") & "', '" & Replace(txtfname.Text, "'", "''") & "', '" & Replace(txtmname.Text, "'", "''") & "', '" & Replace(txtpname.Text, "'", "''") & "',#" & dtpBirthDate.Value & "#," & Age & ",'" & txtNation.Text & "','" & txtstate.Text & "','" & txtlga.Text & "','" & Replace(txthometown.Text, "'", "''") & "','" & IIf((optMale.Value = True), optMale.Caption, optFemale.Caption) & "','" & txtstatus.Text & "','" & Replace(txtemail.Text, "'", "''") & "','" & Replace(txtmobile.Text, "'", "''") & "','" & Replace(txtpadd.Text, "'", "''") & "','" & Replace(txtyearfirst.Text, "'", "''") & "','" & Replace(txtfirstqual.Text, "'", "''") & "','" & Replace(txtschqual.Text, "'", "''") & "'," & _
            "'" & txtregtype.Text & "','" & txtspecialty.Text & "','" & txtcat.Text & "','" & txtstateprac.Text & "','" & txtlgaprac.Text & "','" & Replace(txtres.Text, "'", "''") & "','" & Replace(txtcur.Text, "'", "''") & "','" & Replace(txtpost.Text, "'", "''") & "','" & txtemptype.Text & "'," & Replace(FullPath, "'", "''") & "')")

            MsgBox "New contact successfully added.", vbOKOnly + vbInformation, "Success"

Capture the Insert statement into a string valiable and print it. That way it will be much easier to debug.

This article has been dead for over six months. Start a new discussion instead.