Results 1 to 5 of 5
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    Syntax error in UPDATE query

    Can't seem to find syntax problem with the statement below. (intPCID is dim'd integer. PCNotes and PCID are fields in table tblPerCaps. tbNotes is a text box.)



    Code:
    CurrentDb.Execute "UPDATE tblPerCaps SET PCNotes = " & Me.tbNotes & " WHERE PCID = " & intPCID & ";", dbFailOnError

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Assuming it's a text field, use text delimiters - shown in RED

    Code:
    CurrentDb.Execute "UPDATE tblPerCaps SET PCNotes = '" & Me.tbNotes & "' WHERE PCID = " & intPCID & ";", dbFailOnError
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    if you use a query instead of sql, it will show you the errors.

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    At 2AM I completely forgot I was dealing with SQL syntax. So yes, character strings always require proper delineation in SQL syntax.

    Thanks for the wake-up,
    Bill

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Good point, I'll remember that for future reference.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-09-2014, 10:53 AM
  2. Replies: 1
    Last Post: 09-22-2014, 08:54 AM
  3. Error 3144: Syntax error in UPDATE statement??
    By Paintballlovr in forum Programming
    Replies: 7
    Last Post: 03-26-2014, 12:53 PM
  4. Syntax Error 3144 in SQL Update Query.
    By Phred in forum Programming
    Replies: 4
    Last Post: 03-02-2012, 02:39 PM
  5. SQL Update Syntax Error
    By Phred in forum Queries
    Replies: 9
    Last Post: 02-05-2012, 05:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums