Results 1 to 5 of 5
  1. #1
    theworm is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    7

    Query with dates and text

    We have a training database in our company, some of our classes expire in 6 months, 1 year, 2 year and some will never expire. I have been adding 100 years to the never expire ones, but some people don't like that method. Is there a way that I could have the date expires displayed as the true date and when the date expires is > than x it will display "Never"?
    Thanks for any help.

  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    In your table, if you leave the date field blank (null) for classes that never expire and have dates for those that do, you can use an isNull() function nested in an IIF() function in a query to display what you want. Something along these lines should work

    Code:
    SELECT classname, IIF(isNull(expirationdatefieldname),"Never",expirationdatefieldname) as Expiration
    FROM yourtablename

  3. #3
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Is there a way that I could have the date expires displayed as the true date and when the date expires is > than x it will display "Never"?
    if the [date expires] field is a data/time field, you can't put "Never" in the table, but you can show "Never" in reports or queries or forms

    Please see jzwp11's query example.

  4. #4
    theworm is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    7
    I will try your suggestions.
    Thanks

  5. #5
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Please let us know if it works out for you.

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

Similar Threads

  1. Dates: query and criteria
    By isnpms in forum Queries
    Replies: 5
    Last Post: 08-22-2010, 08:01 AM
  2. Between dates query question
    By ostroms1 in forum Queries
    Replies: 3
    Last Post: 07-23-2010, 05:04 PM
  3. Sorting in a Query (Dates)
    By JohnS in forum Queries
    Replies: 2
    Last Post: 10-23-2009, 03:51 AM
  4. Update query for 12/30/1899 dates
    By P5C768 in forum Queries
    Replies: 8
    Last Post: 09-25-2009, 09:16 AM
  5. Matching Query Dates
    By rgwynne in forum Queries
    Replies: 1
    Last Post: 08-13-2009, 05:23 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