Results 1 to 2 of 2
  1. #1
    TLCTech is offline Novice
    Windows 10 Access 2013
    Join Date
    Dec 2015
    Posts
    26

    How to add more days to a form

    I have 30 days listed on the form for my day results. How can I continue to 60 days on the form? After subtracting "0" and adding 30 days in test31, what would I subtract on test32? I know I can add 31 at the end. When I leave it as subtracting "0", the run says that it is too complex.


    test30: IIf([DepartureDate]<=(Date()-1),0,IIf([ArrivalDate]<=(Date()-1) And [DepartureDate]>=(Date()-1),[DepartureDate]-(Date()-1),IIf((Date()-1)<=[ArrivalDate] And [ArrivalDate]<=(Date()+29) And (Date()-1)<=[DepartureDate] And [DepartureDate]<=(Date()+29),[DepartureDate]-[ArrivalDate],IIf((Date()-1)<=[ArrivalDate] And [ArrivalDate]<=(Date()+29) And [DepartureDate]>(Date()+29),(Date()+29)-[ArrivalDate],IIf([ArrivalDate]>(Date()+29),0,300)))))

    test31: IIf([DepartureDate]<=(Date()-0),0,IIf([ArrivalDate]<=(Date()-0) And [DepartureDate]>=(Date()-0),[DepartureDate]-(Date()-0),IIf((Date()-0)<=[ArrivalDate] And [ArrivalDate]<=(Date()+30) And (Date()-0)<=[DepartureDate] And [DepartureDate]<=(Date()+30),[DepartureDate]-[ArrivalDate],IIf((Date()-0)<=[ArrivalDate] And [ArrivalDate]<=(Date()+30) And [DepartureDate]>(Date()+30),(Date()+30)-[ArrivalDate],IIf([ArrivalDate]>(Date()+30),0,300)))))

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Nesting is limited to 7 levels. I would create a UDF that uses a Case statement. It is more maintainable and readable.

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

Similar Threads

  1. Replies: 9
    Last Post: 03-07-2016, 04:17 PM
  2. Replies: 2
    Last Post: 04-10-2015, 03:51 AM
  3. Replies: 10
    Last Post: 09-08-2014, 03:57 PM
  4. Replies: 3
    Last Post: 07-18-2012, 10:08 PM
  5. Select Dates between days and two days ago?
    By rstonehouse in forum Queries
    Replies: 4
    Last Post: 08-18-2010, 02:13 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