Results 1 to 5 of 5
  1. #1
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15

    Criteria based on a date results in a specific value

    I don't know what it would be called or even how to start doing it in access other than it requires a criteria here is what I'm trying to make happen with access

    name date yes/no criteria would be set to date > 180 days then it would equal value of No < 180 days then equal value Yes



    If i set a today's date value on the database and then criteria is based of the value in the date box with the above information how would this be done

    I'm really lost with this guys please help if anyone can understand what I'm trying to do

  2. #2
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15
    after a little bit more reading and understanding of this guys its like a function i guess in excel except its called a IIF here please assist this is what i came up with off of the examples

    IIf([APFT date]<180,[APFT VALID] ="yes",IIf([APFT date] >180,[apft valid] "no")

    The valid is a yes/no criteria with a check box and the date is the criteria it is checking whether its greater than 180 days or less than

    Does this make sense to anyone?

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    IIf([APFT date]<180,[APFT VALID] ="yes",[apft valid]= "no")

    if the criteria is met [APFT date]<180
    then: [APFT VALID] ="yes"
    else: [apft valid]= "no"

    the IIF syntax simply uses the comma symbol instead of the then/else keywords

  4. #4
    macattack03 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2011
    Posts
    15
    I copied the top IIF command and pasted it in the criteria box in my query however its not working its giving me an error

    Data type mismatch in criteria expression

  5. #5
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    I just dealt with the syntax of an IIF and not the content..... data type mismatch is probably [APFT date]<180 if indeed that is a date field then such a compare doesn't make sense; perhaps: [APFT date]<(Now()-180)

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

Similar Threads

  1. Replies: 3
    Last Post: 12-14-2013, 06:16 PM
  2. Replies: 3
    Last Post: 05-02-2013, 10:36 AM
  3. Replies: 5
    Last Post: 03-01-2013, 04:20 PM
  4. Replies: 1
    Last Post: 09-24-2012, 07:09 PM
  5. Replies: 4
    Last Post: 03-23-2012, 01:18 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