Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21876

[RESOLVED] syntax error missing operator

$
0
0
hey

i get this strange error syntax error missing operator in query expreesion
i checked my code 10 times already
this happens only when i update a record.
this is the code.
you tell me whats wrong guys

Code:

If NewRec Then
        Dim NewID As Long
        NewID = NextID("SupID", "Suppliers")
        Dim strSQL As String
strSQL = "INSERT INTO Suppliers "
strSQL = strSQL & "(SupID, SupName, SupPhone, SupCell, SupCompany, SupBranch, SupFax, SupPhoneOffice, SupCredit, SupDiscount, SupRemarks)"
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","                         
strSQL = strSQL & "'" & RplS(Txt(0).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(1).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(2).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(3).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(4).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(5).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(6).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(7).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(8).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(9).text) & "'"
strSQL = strSQL & ")"
CN.Execute strSQL

        Set Itm = FrmSuppliers.LsVw.ListItems.Add(, , Txt(0).text, , "sup")
        Itm.Tag = NewID
        Itm.SubItems(1) = Replace$(Txt(1).text, ",", ".")
        Itm.SubItems(2) = Replace$(Txt(2).text, ",", ".")
        Itm.SubItems(3) = Replace$(Txt(3).text, ",", ".")
        Itm.SubItems(4) = Replace$(Txt(4).text, ",", ".")
        Itm.SubItems(5) = Replace$(Txt(5).text, ",", ".")
        Itm.SubItems(6) = Replace$(Txt(6).text, ",", ".")
        Itm.SubItems(7) = Replace$(Txt(7).text, ",", ".")
        Itm.SubItems(8) = Replace$(Txt(8).text, ",", ".")
        Itm.SubItems(9) = Replace$(Txt(9).text, ",", ".")
       
       
       
        If ChkRepeat.Value Then
         
            Txt(0).text = ""
            Txt(1).text = ""
            Txt(2).text = ""
            Txt(3).text = ""
            Txt(4).text = ""
            Txt(5).text = ""
            Txt(6).text = ""
            Txt(7).text = ""
            Txt(8).text = ""
            Txt(9).text = ""
            ChkRepeat.Value = 0
         
            Exit Sub
        End If
    Else
   
        With FrmSuppliers.LsVw.SelectedItem
        strSQL = "UPDATE Suppliers SET "
       
strSQL = strSQL & "SupName = '" & RplS(Txt(0).text) & "',"
strSQL = strSQL & "SupPhone = '" & RplS(Txt(1).text) & "',"
strSQL = strSQL & "SupCell = '" & RplS(Txt(2).text) & "',"
strSQL = strSQL & "SupCompany = '" & RplS(Txt(3).text) & "',"
strSQL = strSQL & "SupBranch = '" & RplS(Txt(4).text) & "',"
strSQL = strSQL & "SupFax = '" & RplS(Txt(5).text) & "',"
strSQL = strSQL & "SupPhoneOffice = '" & RplS(Txt(6).text) & "',"
strSQL = strSQL & "SupCredit = '" & RplS(Txt(7).text) & "',"
strSQL = strSQL & "SupDiscount = '" & RplS(Txt(8).text) & "',"
strSQL = strSQL & "SupRemarks = '" & RplS(Txt(9).text) & "'"
strSQL = strSQL & " WHERE SupID = " & .Tag
CN.Execute strSQL
           
         
       
       
            Txt(0).text = .text
            Txt(1).text = .SubItems(1)
            Txt(2).text = .SubItems(2)
            Txt(3).text = .SubItems(3)
            Txt(4).text = .SubItems(4)
            Txt(5).text = .SubItems(5)
            Txt(6).text = .SubItems(6)
            Txt(7).text = .SubItems(7)
            Txt(8).text = .SubItems(8)
            Txt(9).text = .SubItems(9)
     
           
        End With
    End If
    Unload Me


Viewing all articles
Browse latest Browse all 21876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>