date parameters

  • Thread starter Thread starter JohnB
  • Start date Start date
J

JohnB

can someone please tell me if it is possible to use two
unbound boxes in the main switchboard that I can use for
date parameters to pull up reports? For example I need to
pull up all the icu procedures between 1-Apr-03 to 31-Mar-
04. I really don't want to have to remember at the end of
the year to go and change all the date values in every
query. Is it possible and how do I go about doing it? I
am using Access 97 and am relatively a new user.

Thanks for your help.
 
Certainly... if it is your own switchboard form... even if it's not you can
create a form just to collect the dates from the user.

Don't use a parameter query. Base your report on the query you want to use
but with no WHERE clause.

For dates in TextBoxes txtFrom and txtTo, in the code behind the
CommandButton:

Dim strWhereCond as String
strWhereCond = "BETWEEN #" & Me!txtFrom & "# AND #" & Me!txtTo & "#"
DoCmd.OpenReport "yourreportsname",,,strWhereCond

It would be a good idea, though to check to make certain a date _has_ been
entered into both those Text Boxes, lest the user get an ungracious error
message of some kind when one is omitted.

Larry Linson
Microsoft Access MVP
 
Back
Top