Error in Updateing my table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nkechifesie
    New Member
    • Nov 2006
    • 62

    Error in Updateing my table

    I am trying to update my tables, and this error occurs
    Runtime error '-2147217900 (80040e14)':syn tax error in update statement only for the table Action types.This is the code
    and where error occurs is in Bold
    Code:
    If frmAdd.Caption = " CITY " Then
            StrSql = "UPDATE City SET CITY = '" & Text1.Text & "' WHERE CITY _
             = '" & OldVal & "'"
            CnEdit.Execute StrSql
    ElseIf frmAdd.Caption = " TYPE OF ACTION " Then
            StrSql = "UPDATE ActionTypes SET Action = '" & Text1.Text & "' _
            WHERE Action = '" & OldVal & "'"
            [B]CnEdit.Execute StrSql[/B]
    ElseIf frmAdd.Caption = " RNE NAME " Then
            StrSql = "UPDATE RNE_names SET RNEName = '" & Text1.Text & "' _
            WHERE RNEName = '" & OldVal & "'"
            CnEdit.Execute StrSql
        End If
    please not that all parameters have been set and the error doesnt occur when the caption is City or RNE Names.
    Thank you.
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. If you have pasted your code here the answer is easy enough.
    Code:
    StrSql = "UPDATE ActionTypes SET Action = '" & Text1.Text & "' _
            WHERE Action = '" & OldVal & "'"
    is missing quote marks
    Code:
    StrSql = "UPDATE ActionTypes SET Action = '" & Text1.Text & "'" _
            & " WHERE Action = '" & OldVal & "'"
    This is on all 3 of your sql statements

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by willakawill
      Hi. If you have pasted your code here the answer is easy enough.
      Code:
      StrSql = "UPDATE ActionTypes SET Action = '" & Text1.Text & "' _
              WHERE Action = '" & OldVal & "'"
      is missing quote marks ...
      But how would that have made it past syntax check?

      Comment

      • willakawill
        Top Contributor
        • Oct 2006
        • 1646

        #4
        Originally posted by Killer42
        But how would that have made it past syntax check?
        We have to start somewhere. How could we get any further than obvious typos if we don't get them straight first?

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by willakawill
          We have to start somewhere. How could we get any further than obvious typos if we don't get them straight first?
          Excellent point. Just wondered whether I've missed some "continue with errors" option or something.

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            I've got it! Bet you $5 that Action is numeric. :)

            Comment

            • nkechifesie
              New Member
              • Nov 2006
              • 62

              #7
              RESOLVED
              Thanks for all your help. I discovered Action as a reserved word in VB, changed the column name and now it works.

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by nkechifesie
                RESOLVED
                Thanks for all your help. I discovered Action as a reserved word in VB, changed the column name and now it works.
                Rats! There goes my 5 bucks.

                Glad to hear you've resolved the problem, though. :D

                Comment

                Working...