Results 1 to 5 of 5
  1. #1
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34

    problem with IF THEN statement in access 2003 query

    Trying to figure out what I'm doing wrong with this IF THEN statement that I am trying to use in a query.



    Expr4: Iif(([MCA_EPM_ISSUES]![QTR])="4",“TEST”,“ “)

    In this case, the "QTR" field is designated as a text field in the design view of the table "MCA_EPM_ISSUES".

    Any suggestions?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    What is wrong - error message, wrong results, nothing happens? I assume the table is included in the query. Show the SQL statement. If QTR is not =4 you want an empty string or a space? My practice is to return Null.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34
    It says invalid syntax. "You may have entered an operand without an operator. The table is included in the query.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Aside from unnecessary set of parens and funny-looking quote marks, don't see anything wrong. I copy/pasted your expression into a query. It has issue with the quote marks. I have encountered this before. Try completely retyping the expression.

    Iif(([MCA_EPM_ISSUES]![QTR])="4","TEST","")
    Note no space between the last quote pair.

    or

    Iif(([MCA_EPM_ISSUES]![QTR])="4","TEST",Null)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34
    Thanks very much!

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

Similar Threads

  1. Help access 2010 to 2003 vba and sql problem!
    By bcox9 in forum Programming
    Replies: 4
    Last Post: 12-21-2011, 09:42 PM
  2. MS Access 2003 running 64 bit system problem
    By stan_the_man21ph in forum Access
    Replies: 3
    Last Post: 09-14-2011, 10:52 PM
  3. Intriguing Access 2003 Bracket problem
    By pinecrest515 in forum Access
    Replies: 1
    Last Post: 02-22-2011, 04:35 PM
  4. Access 2003 subform linking problem
    By RANCHLAW56 in forum Access
    Replies: 1
    Last Post: 12-26-2010, 05:35 PM
  5. Problem with Access 2003 database after moving PCs
    By ValiantSaint in forum Access
    Replies: 2
    Last Post: 06-25-2010, 01:55 AM

Tags for this Thread

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