Results 1 to 4 of 4
  1. #1
    ArvinFx is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    15

    iif and date format problem

    In my report,I need to set the dates before 1/1/2017 as "Expire" instead of ?/?/2017, and after that time the filed date but in dd-mmm-yy format.



    for this reason i have to write a query and set an "IIF" function as you can see in attachment, but problem is output of IIF function. It is text it is not Date! so Msaccess can not sort it or do any format style on it! I searched and found CDate function and half of my problem solved but when this function input is "Expire" the output is #Error !!!

    Plz show me the way. thanks
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    Make 2 fields,1 text says EXPIRED, the other is the date.
    make 1 visible,one not.

    txtExpire.visible=txtDate<="1/1/17"
    txtDate.visible = not txtExpire.visible

  3. #3
    ArvinFx is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    15
    Thanks, Where I have to put this code in Report form?

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In your query, remove the CDate in the IIf statement - you are trying to change the word "Expire" into a date and Access doesn't like that.

    Not sure what you are wanting with the sort order.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-30-2016, 10:27 AM
  2. Problem with date format in access 2010
    By BobsWright in forum Access
    Replies: 3
    Last Post: 03-15-2013, 05:21 PM
  3. Replies: 4
    Last Post: 03-12-2013, 06:49 PM
  4. Date Format Problem
    By wrangler_0002004 in forum Access
    Replies: 7
    Last Post: 07-21-2012, 10:33 PM
  5. Having problem in date format
    By paddybear in forum SQL Server
    Replies: 3
    Last Post: 01-06-2012, 01:22 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