Results 1 to 4 of 4
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    494

    NZ() doesnt work for date range

    I am trying to use NZ or an IF statement to determine a date range or if nothing entered look for all data. I have two field boxes one for BeginDate one for EndDate. If the user puts dates in I want to use those and if the user does not then I can use a date from the first entry and the current date.



    NZ(between [forms]![f_validate]![BeginDate] AND [forms]![f_validate]![EndDate], between #1/1/1960# AND Now())

    Or

    IIF([forms]![f_validate]![BeginDate] AND [forms]![f_validate]![EndDate] is Null, between #1/1/1960# AND Now(), between [forms]![f_validate]![BeginDate] AND [forms]![f_validate]![EndDate])

    But neither of them seem to work

  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,640
    You haven't used it properly. Try

    between Nz([forms]![f_validate]![BeginDate], #1/1/1960#) AND Nz([forms]![f_validate]![EndDate], Now())
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    494
    yep, silly me. I should have thought of that. I tried it and it works fine.
    Thanks

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    No problemo.
    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. Web DB Subform drag&drop doesnt work
    By Stefan in forum Forms
    Replies: 6
    Last Post: 11-27-2012, 01:42 PM
  2. Replies: 6
    Last Post: 09-02-2012, 04:30 PM
  3. Query runs fine but report doesnt work
    By endri81 in forum Queries
    Replies: 4
    Last Post: 04-28-2012, 02:35 PM
  4. Replies: 2
    Last Post: 09-08-2011, 11:14 AM
  5. Help I dunno y it doesnt work
    By zaza123 in forum Programming
    Replies: 7
    Last Post: 07-03-2011, 06:43 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