Results 1 to 15 of 15
  1. #1
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144

    Question Parameter Box Date Range


    My table has one date of service field. In my query, I have a criteria to query a range, e.g., Between 03/01/2013 and 05/31/2013. Is there a way to put this in a parameter box so when users click the query they will get a parameter box to enter date range? I know how this works for a single date, not sure if it can be done with a range.

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Yes you can.
    Enter 2 parameters in the parameter box.

    Type Between [par1] AND [par2]

    Dale

  3. #3
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Hi Dale,

    I did try this entry Between 3/1/2013 and 3/31/2013 before and got a message that the entry was too complex.

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    You have to use the Parameter names.
    If you are going to use the dates enclosed the with #.
    Between #3/1/2013# AND #3/31/2013#

    Dale

  5. #5
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    I tried that as well. No worries, I'll convert the date range to months in a parameter box. Thanks anyway.

  6. #6
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Sorry I have to revisit this issue again for another db. I can successfully add Between 01/01/2013 and 07/31/2013 in the criteria and get the results.
    When I enter [Enter Date Range] in as the criteria and I'm prompted to enter the date range . . . I am getting the error "This expression is typed incorrectly, or is too complex to be evaluated" I have tried it as Between #01/01/2013# AND #07/31/2013# and without the #, is there any other way to do this?

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Have you tried 2 parameters eg Date1 and Date2

    Between Date1 AND Date2

  8. #8
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Are you saying to add two fields and call them 1 and 2? and a third for the criteria?

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    No I was suggesting QUERY along this structure.
    Code:
    PARAMETERS [Bdate] DateTime, [Edate] DateTime;
    SELECT Orders.OrderID, Orders.OrderDate, Orders.ShipVia, Orders.ShipName
    FROM Orders
    WHERE (((Orders.OrderDate) Between [Bdate] And [EDate]));

  10. #10
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Oh, sorry. I'll give that a try. Thanks for the advice.

  11. #11
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    I'm just now getting back to this project. Your suggestion worked perfectly. Thanks so much!

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  13. #13
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    Another element to this question please: is it possible to modify the above code for a parameter box to show, e.g., <= 08/31/2013?

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    How does <= 08/31/2013 fit with BDate and EDate?

    You can change the SQL
    eg
    Code:
    PARAMETERS [MyDate] DateTime;
     SELECT Orders.OrderID, Orders.OrderDate, Orders.ShipVia, Orders.ShipName FROM Orders 
    WHERE ((Orders.OrderDate) <= MyDate);

  15. #15
    buckwheat is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jan 2013
    Posts
    144
    thanks for the advice

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

Similar Threads

  1. Replies: 1
    Last Post: 03-06-2013, 10:30 AM
  2. Replies: 3
    Last Post: 07-18-2012, 10:13 PM
  3. Date Range Report with Multiple Date Fields
    By StevenCV in forum Reports
    Replies: 13
    Last Post: 02-29-2012, 08:29 AM
  4. Parameter Date - Force a Monday Date
    By ker9 in forum Queries
    Replies: 3
    Last Post: 07-26-2011, 01:06 PM
  5. Date Range Parameter help!?!?
    By dkstech in forum Access
    Replies: 1
    Last Post: 01-15-2011, 11:05 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