Results 1 to 4 of 4
  1. #1
    ice051505 is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Feb 2013
    Posts
    76

    sql on VBA code

    Hi all, just quick question



    this is my sql on VBA code

    Sql1 ="Select [SmallArea] From [AreaQuery1] WHERE [SmallArea]="NA";"

    I try to find any record in SmallArea that contain "NA", it give me the compile error of "expected: end of statement"

    Can anyone fix it for me? Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You need single quotes within the string. As is, you end the string right before NA:

    Sql1 ="Select [SmallArea] From [AreaQuery1] WHERE [SmallArea]='NA';"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ice051505 is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Feb 2013
    Posts
    76
    Thank you!

    Quote Originally Posted by pbaldy View Post
    You need single quotes within the string. As is, you end the string right before NA:

    Sql1 ="Select [SmallArea] From [AreaQuery1] WHERE [SmallArea]='NA';"

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  2. Code in combobox, code in text box
    By float in forum Forms
    Replies: 3
    Last Post: 09-29-2010, 07:12 AM
  3. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 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