Results 1 to 7 of 7
  1. #1
    kalkap is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    5

    or statement problems

    I'm using the IIF function with the OR statement in a query. The issue I'm having is that the expression will return the proper result if the true statement is true but is giving the #Error instead of the if false value?

    The expression I'm using is:

    IIf([Outage Due(Raw)]="26" Or [2nd Due]="26",[PMRQ Title],"N/A")



    Here is selected screenshot of the result using the above expression if that helps anyone.
    https://docs.google.com/document/d/1...it?usp=sharing

    I'm sure there is an easy reason but I can't seem to figure it out. I would appreciate any insight anyone might have. Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I can't view that image now (blocked). If you attached it to post I could view.

    This is an expression to construct a field in query?

    I can't see anything wrong with it.
    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
    kalkap is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    5
    Quote Originally Posted by June7 View Post
    I can't view that image now (blocked). If you attached it to post I could view.

    This is an expression to construct a field in query?

    I can't see anything wrong with it.
    Sorry about the link. It worked before I posted it, but I have attached it here. I'm on the novice side using Access but if I understand you correctly, I am using an expression to construct a field.
    Attached Thumbnails Attached Thumbnails Screen Shot 2014-03-03 at 5.45.48 PM.png  

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I expect the link was good, I was simply blocked (IT restrictions).

    I can barely see another field showing #Error but can't see the fields used in the expression.

    Unfortunately, that image doesn't help find the cause.

    Next step is to provide the db. If you want, follow instructions at bottom of my post.
    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
    kalkap is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    5
    Quote Originally Posted by June7 View Post
    I expect the link was good, I was simply blocked (IT restrictions).

    I can barely see another field showing #Error but can't see the fields used in the expression.

    Unfortunately, that image doesn't help find the cause.

    Next step is to provide the db. If you want, follow instructions at bottom of my post.
    I have attached a small excerpt of the database containing only the Table and Query that are used. I have a table of several hundred component maintenance tasks that are done on specified frequencies. I'm trying to use the query to project where each of the maintenance tasks fall in the 2nd, 3rd, 4th etc interval out. If you look at the query and start with the U1C26 column, that is where my issue starts. As you will see, the U1C26 column is an expression that is reading from another column containing an expression.

    I appreciate the help.
    Attached Files Attached Files

  6. #6
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Problem is that you are compare number against text.

    U1C26: IIf([Outage Due(Raw)]="26" Or [2nd Due]=26,[PMRQ Title],"N/A")
    [Outage Due(Raw)] is text. [2nd Due] is number. I remove the double quote and the expression worked. I guess is the same problem for all the others as well.

  7. #7
    kalkap is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    5
    Quote Originally Posted by lfpm062010 View Post
    Problem is that you are compare number against text.

    U1C26: IIf([Outage Due(Raw)]="26" Or [2nd Due]=26,[PMRQ Title],"N/A")
    [Outage Due(Raw)] is text. [2nd Due] is number. I remove the double quote and the expression worked. I guess is the same problem for all the others as well.
    That worked! Thank you. This text vs number concept has been my biggest headache in moving over from Excel to Access. Thanks again.

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

Similar Threads

  1. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  2. Replies: 11
    Last Post: 03-21-2012, 12:51 PM
  3. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  4. IIF Problems
    By suverman in forum Queries
    Replies: 3
    Last Post: 05-23-2011, 02:22 AM
  5. Problems with an If statement
    By slenish in forum Access
    Replies: 1
    Last Post: 03-10-2010, 09:23 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