Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update text (Access 2000)

    How can i update text. When i am updating with figures, my code is ok, for example when i update with 25, the field is update and shows 25 :
    StrSQL = " UPDATE [my company information] SET mcfinvoiceNr = 25"
    However, if i want to put some words before that i get a syntax error :

    StrSQL = " UPDATE [my company information] SET mcfinvoiceNr = Invoice 0025"

    What is wrong with my code ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Update text (Access 2000)

    Text values must be surroudend by quotes. You cannot simply use double quotes <code>"</code>, because those are already used to indicate the beginning and end of strSQL. There are two possibilities:

    1) Use double double quotes:
    <code>
    strSQL = "UPDATE [my company information] SET mcfinvoiceNr = ""Invoice 0025"""
    </code>
    2) Use single quotes:
    <code>
    strSQL = "UPDATE [my company information] SET mcfinvoiceNr = 'Invoice 0025'"</code>

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update text (Access 2000)

    Thank you ! works great !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •