Results 1 to 5 of 5
  1. #1
    Madmax is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    80

    Help on an IIF statement

    Hello me again,



    new Problem developed see enclosed code


    If IsDate(Me![PRDA Review C/w] & Me![PIF Review C/W]) = True Then
    Me![Check56] = 1
    Else
    Me![Check56] = 0
    End If

    The purpose is to check and see if both the first field and the secondfield both have dates in them. If true then it should set the checkbox to yes and false to no. Works great if I am just IsDate'ing on one field. However, when I add a and and a second field I have a slight issue. If one field has a date it check marks(not supposed to without other) and if both are dated, the Checkmark is off

    Any thoughts?

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    1.
    If IsDate(Me![PRDA Review C/w] & Me![PIF Review C/W]) = True Then

    Should be

    If IsDate(Me![PRDA Review C/w]) AND IsDate(Me![PIF Review C/W]) Then

  3. #3
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Oh, and in your title you said IIf and in the post it is obviously an IF instead. Make sure you use the right terminology when talking about one or the other. They are quite different in fact, so it is good to state the right one when you are asking about it.

  4. #4
    Madmax is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    80
    I thought IFF is the expression builder version of IF in VBA. is there more difference there? I will be sure to be exact on it. BTW Thank you I should of know what works in the builder wouldnt work in the code line the same. Your a life saver.

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    IIF (Immediate If - and two letter I's and only one F) is something which checks for a condition and it evaluates both what to do if it is true and what to do if it is false. It evaluates both regardless of which one it will eventually use based on the condition.

    IF is part of the If...Then...Else structure where it evaluates a condition (the IF part) and then goes to the applicable part - if it meets that condition then it goes to the Then part but if it doesn't meet the condition it goes right away to the Else part (or ElseIF part if there is any). It does NOT evaluate both the true and the false responses when it works. It ONLY goes to the part that is applicable.

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

Similar Threads

  1. If Statement
    By ajolson1964 in forum Access
    Replies: 1
    Last Post: 05-11-2011, 07:51 AM
  2. Help with an Iif statement please
    By 10 Gauge in forum Programming
    Replies: 4
    Last Post: 04-05-2011, 06:02 AM
  3. iff Statement
    By tkandy in forum Access
    Replies: 0
    Last Post: 03-20-2011, 02:31 PM
  4. Help with IF statement
    By mkallover in forum Programming
    Replies: 7
    Last Post: 01-04-2011, 04:47 PM
  5. If Then Statement Help
    By Kapelluschsa in forum Programming
    Replies: 5
    Last Post: 08-11-2010, 09:24 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