Results 1 to 3 of 3
  1. #1
    jcc285 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    70

    Concatenating string literal and variable in SQL Update statement

    I have three possible titles, 'Leader', 'Co-ordinator' or 'Convenor' from which a user selects one, which is assigned to a string variable, say strTitle



    I need to update a table so that a report description reflects the users choice.

    I need: "strSQL = UPDATE tbl_Reports SET [Description] = "Group " + strTitle"

    I have been trying any number of single and double quote combinations here but cannot get this to work.

    Any help gratefully received.

  2. #2
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    I always have difficulty with the quotes. To ensure that I get it right, I use the attached converter and it never fails.
    Attached Files Attached Files

  3. #3
    jcc285 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2014
    Posts
    70
    Thank you, I now have:

    strSQL = "UPDATE tbl_Reports SET [DisplayName] = ""Group " & strTitle & """ WHERE [ID] = 11"

    Access now very happy as well as me !!

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

Similar Threads

  1. Using A String Literal In Query String
    By Juan4412 in forum Programming
    Replies: 1
    Last Post: 05-24-2017, 08:45 AM
  2. Getting whole value from a string variable
    By Always_Learning in forum Programming
    Replies: 4
    Last Post: 09-30-2016, 06:57 AM
  3. Stuck on Access concatenating into string
    By orangeman2003 in forum Queries
    Replies: 6
    Last Post: 12-25-2013, 03:16 AM
  4. Replies: 3
    Last Post: 05-28-2013, 12:53 PM
  5. Replies: 5
    Last Post: 05-29-2012, 08:50 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