Results 1 to 2 of 2
  1. #1
    elegant is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2011
    Posts
    1

    IIF statement using a date

    I have a date field in a table and i want to write an IIf statement in a query wizard using that date to get another date field.

    The date field i already have in one of the tables is SaleDate. i need for the IIF statement to give me First day of the month that the file goes to sale (will always be mm/dd/yyy format)

    Lets just say the saledate is 05/09/2011 i need the iif statement to give me 05/01/11. Its always the first day of the saledate month

    I would start the iff statement with this IIf[SaleDate] ---but then i dont know the rest of it.

    If anyone can help me it would be greatly appreciated.

    Thank you.

  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
    I don't think you want an IIf(), you want DateSerial(). Use the Month() and Year() functions with your sale date and hard-code the day argument to 1.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. iif statement to generate date
    By Theremin_Ohio in forum Access
    Replies: 8
    Last Post: 05-31-2011, 07:52 AM
  2. ISO8601 Date in a IIF Statement
    By monkeyman in forum Queries
    Replies: 2
    Last Post: 05-23-2011, 12:16 PM
  3. Date Field empty if statement
    By dubsdj in forum Programming
    Replies: 4
    Last Post: 03-06-2011, 04:02 PM
  4. Replies: 1
    Last Post: 07-07-2010, 04:22 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