Results 1 to 3 of 3
  1. #1
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283

    DateSerial and IIF Statements

    I am trying to look for data within the current month, next month and next month after that (30, 60, 90)

    I have this piece working so far and if the order date falls within current month the report was run in it sets the field to 30 day and sets all others to EXPIRED


    MPL_Range: IIf([OPTY_PROD]![Order Date] Between (DateSerial(Year(Date()),Month(Date()),1)) And (DateSerial(Year(Date()),Month(Date())+1,0)),'30
    Day','EXPIRED')

    When I try to add the other parameters it throws an error of invalid arguments and highlights the character in bold.

    MPL_Range: IIf([OPTY_PROD]![Order Date] Between (DateSerial(Year(Date()),Month(Date()),1)) And (DateSerial(Year(Date()),Month(Date())+1,0)),'30
    Day',IIf([OPTY_PROD]![Order Date] Between (DateSerial(Year(Date()),Month(Date()),+1,1)) And (DateSerial(Year(Date()),Month(Date())+2,0)),'60
    Day','EXPIRED'))

    I am basically trying to get it to say if the order date is in the current month set it to 30 Day, if the order date is in the next month set it to 60 Day, if the order date is in the next month after that set it to 90 Day else EXPIRED

    Please Help

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Try:

    MPL_Range: IIf(Format([Order Date],"yyyymm") = Format(Date(),"yyyymm"), "30 Day", IIf(Format([Order Date],"yyyymm")=Format(DateAdd("m",1,Date()),"yyyymm"), "60 Day", IIf(Format([Order Date],"yyyymm")=Format(DateAdd("m",2,Date()),"yyyymm"), "90 Day", "EXPIRED")))
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    that worked awesome!!! thank you very much

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

Similar Threads

  1. DateAdd DateSerial
    By aellistechsupport in forum Queries
    Replies: 2
    Last Post: 04-30-2014, 05:09 PM
  2. Dateserial and datetime
    By webisti in forum Access
    Replies: 1
    Last Post: 06-17-2013, 11:31 AM
  3. Problem with a DateSerial Function
    By razkowski in forum Queries
    Replies: 1
    Last Post: 01-31-2013, 04:47 PM
  4. DateSerial Format
    By venu_resoju in forum Reports
    Replies: 4
    Last Post: 01-19-2013, 02:20 AM
  5. Replies: 2
    Last Post: 08-07-2012, 02:02 PM

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