Results 1 to 6 of 6
  1. #1
    4shl3y is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    4

    date range text boxes

    On a form I have a start date text box and an end date text box that are linked to a query. Right now if the boxes are left empty nothing shows up. I want to know if they are left empty is there a way to have the query show all of the dates.

    This is what I have in the criteria on my query: Between [Forms]![2012 Rates Form]![Start Date] And [Forms]![2012 Rates Form]![End Date]

    The dates are part of how long a program has run. Some programs have run for multiple years so a person may not know the start date. I would like the form to have an option either by leaving the text boxes blank or with something else to have all of the dates of the program show up.

  2. #2
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    What you can try:

    Between Nz([Forms]![2012 Rates Form]![Start Date],CDate(1)) And Nz([Forms]![2012 Rates Form]![End Date], CDate(Date()))

    If you want to extend the end date beyond today then use something like CDate(Date() + 365)

    Anyone else?

  3. #3
    4shl3y is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    4
    that didn't work for me, anything else?

  4. #4
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Are you getting an error message? If so, what is it?

  5. #5
    4shl3y is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    4
    No matter which query I try it on (always use a test one first), it just freezes my database, normally my query pops right up.

  6. #6
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Here's a simplistic db showing that the construct works:

    Database7.accdb

    I can't help any more without seeing your db and code.

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

Similar Threads

  1. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  2. Date Range Report with Multiple Date Fields
    By StevenCV in forum Reports
    Replies: 13
    Last Post: 02-29-2012, 08:29 AM
  3. Replies: 15
    Last Post: 04-01-2011, 11:41 AM
  4. Filtering by text or date range
    By Ashe in forum Forms
    Replies: 5
    Last Post: 03-07-2011, 03:00 PM
  5. Replies: 15
    Last Post: 09-18-2010, 01:19 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