Results 1 to 2 of 2
  1. #1
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20

    Query built in VBA

    Hello guys,

    I have the following piece of code:

    writeQ.SQL = "BEGIN UPDATE HR_ASSOCIATE_DATA SET USER_ID = '" & IIf(PAR_USERID = "", "N/A", PAR_USERID) _
    & "', LEVEL_NUMBER = " & IIf(PAR_LEVEL = "", "-1", PAR_LEVEL) _


    Can someone explain what this does or...at least the syntax like underscores, quotes, double quotes and the & symbols...



    I'm really lost with this type of notation...

  2. #2
    KathyL is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    94
    Quote Originally Posted by doci4a View Post
    Hello guys,

    I have the following piece of code:

    writeQ.SQL = "BEGIN UPDATE HR_ASSOCIATE_DATA SET USER_ID = '" & IIf(PAR_USERID = "", "N/A", PAR_USERID) _
    & "', LEVEL_NUMBER = " & IIf(PAR_LEVEL = "", "-1", PAR_LEVEL) _


    Can someone explain what this does or...at least the syntax like underscores, quotes, double quotes and the & symbols...

    I'm really lost with this type of notation...
    I can never understand why some developers use such complex query SQL, when one can just use a standard Access query. I’ve done some very complicated stuff but I avoid complex SQL as I just don’t see the need for it much.
    Anyway.
    1. If one needs quotes inside of quotes, then one has to use single quotes inside of doubles, or vise versa.
    2. The underscores are just a character as part of the full name. ‘HR_ASSOCIATE_DATA” is a full name of either a field or a table.
    3. "&" is the concatenation symbol. It strings two string values together.
    4. The underscore at the end of the line means the line continues to the next line.

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

Similar Threads

  1. Replies: 26
    Last Post: 09-27-2010, 09:48 PM
  2. Allow Built-in Toolbars
    By DianeG in forum Access
    Replies: 0
    Last Post: 08-26-2010, 06:04 PM
  3. Replies: 3
    Last Post: 08-04-2010, 12:33 PM
  4. Linking built queries to new tables
    By prag in forum Queries
    Replies: 6
    Last Post: 10-09-2009, 01:07 PM
  5. never built a database
    By g48dd in forum Access
    Replies: 2
    Last Post: 12-08-2008, 10:21 AM

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