Results 1 to 3 of 3
  1. #1
    tennis2600 is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    2

    iif statement - return a formatted date field

    Hi Everyone,

    I am trying to use an iif statement that will return a date formatted as a date. Currently I am not sure what format the field is being returned in, but it looks like text, not an actual date. My iif statement is comparing a field in a given table and says if that field is L then use the date field from table A, but if it isn't L then use the date field from table B. Both Table A and B fields are date fields. Any ideas how I can get the query to format the iif statment?

    Thanks for all your help!

    Mike

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Might help to see your statement.

    Offhand, the CDate() function may work. If you're using the Format() function, it does return a string. I'd do the formatting on the form or report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tennis2600 is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2015
    Posts
    2

    Thanks!!!!!

    Thanks for your help!!!

    this is my expression now
    PREV_OP_END_DATE: IIf([V_JOB_OPERATIONS]![LMO]="L",CDate(([WORKORDER_OPEN_OPS_TABLE]![END_DATE])),CDate([MATERIAL ON ORDER FOR SCHEDULING QUERY]![DUE_DATE_L]))

    It is working except I get the "#Error" when the filed is null. Any ideas on how I can get it to stay null?





    Quote Originally Posted by pbaldy View Post
    Might help to see your statement.

    Offhand, the CDate() function may work. If you're using the Format() function, it does return a string. I'd do the formatting on the form or report.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-23-2014, 11:32 AM
  2. Replies: 3
    Last Post: 09-19-2012, 08:59 AM
  3. Replies: 3
    Last Post: 04-01-2012, 01:40 PM
  4. Date Entry in formatted field
    By gg80 in forum Forms
    Replies: 2
    Last Post: 02-10-2012, 06:35 PM
  5. Replies: 1
    Last Post: 04-15-2010, 02:07 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