Results 1 to 9 of 9
  1. #1
    crcastilla is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    18

    Question

    So let's say I have two fields.
    Status field and due date field.
    I want it so when the due date is past due in the status field will appear the word "expired" and if not then the word "on time" will appear on the status field.
    How can I do this?
    Thank you so much in advance

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It does not belong in a field in a table. Use a query to generate the calculated field.

  3. #3
    crcastilla is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    18
    yes that was my fault, it is in a query but i dont know what to put in the calculated field

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Status:= IIF( [DueDate] =< Date, "Expired", "On Time")

  5. #5
    crcastilla is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    18
    this is the exact thing that i put:
    Status:=IIF([Cal Due]=<Date, "Expired", "On Time")
    it tells me that the expression contains an invalid syntax

  6. #6
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by crcastilla View Post
    this is the exact thing that i put:
    Status:=IIF([Cal Due]=<Date, "Expired", "On Time")
    it tells me that the expression contains an invalid syntax
    The order of the comparison operators makes a difference. Try

    =IIF([Cal Due] <= Date, "Expired", "On Time")

  7. #7
    crcastilla is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    18
    That work just fine! thank you so much but when I run it it tells me to enter a parameter value for the date so i would have to put the present day each time i enter the query. is there anyway way so it updates automatically?
    I apologize i keep bothering

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Hi

    Maybe you need some brackets after Date:
    Code:
    =IIF([Cal Due]<=Date(), "Expired", "On Time")
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for pitching in guys. I've been gone all day.

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

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