Date Calander for Query/Report

C

C.R. Houk

Currently I have a report that links to a Query. The
query has a Criteria in the "Date" column for [Date of
Test]. When the report is run a box opens in which the
test date is typed in and the appropriate information is
displayed in the report.
What I want is a little more user friendly method. I am
looking for a way to have the Calander Control open when
the report is run and the user simply clicking on the
appropriate date to satisfy the criteria of [Date of
Test]. Is there any way to do this?

Thank you for your time.

C.R. Houk
charles.houk2<remove>@charleston.af.mil
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes.

Create a form that has the calendar control on it. When the report
opens, open the form in acDialog WindowMode. When the user selects
the date they should click an OK button. The OK button sets the
form's Visible property to False. (A Cancel button closes the
criteria form). Setting the form's Visible to False will cause the
code in the report's Open event to re-start. That code will check if
the form is still open (use the IsLoaded() function) & continue the
report if it is open or close the report if the form is not open (the
Cancel button was clicked).

The query will have a parameter like this:

PARAMETERS Form!frmCriteria!ctlCalendar Date;
SELECT ...
FROM ...
WHERE Date_Column = Form!frmCriteria!ctlCalendar

This allows the query to "see" the value of the Calendar control on
the inVisible criteria form and use it to filter the query.

The report should close the criteria form when the report closes:

Private Sub Report_Close()
On Error Resume Next
DoCmd.Close acForm, "frmCriteria"
Edn Sub

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEZJYIechKqOuFEgEQJeigCcC+GS+5Bt7W2ttwBVgqdMj+zFeZkAoJRO
Q/SXvjmMSu8DbOZy0BmcIDgN
=u/AD
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top