Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I place a calender control to set query criteria and report? 1

Status
Not open for further replies.

LDP

IS-IT--Management
Sep 24, 2002
32
BB
I have a report based on a query that sets the date range for monthly reports. Can I use the calender control to set
the dates in the criteria "Between [Enter Start Date of Month:] And [Enter End of Month Date:]" in the query instead of typing in the actual dates in the pop-forms?

Thanks for any help.
 
You can create a seperate form with the Beginning Date and Ending Date text controls along with appropriate calendar controls to assist in filling these controls with the correct date value. You query that is the Record Source for the report can reference the text box controls on this form in the criteria statement of the appropriate fields.

You would first make a VBA call to open the form.

Code:
DoCmd.OpenForm "frmPromptForDates"

Place a command button on this form that is disabled until both date text boxes have been updated with a legitimate date value. When this happens the following code can be executed. This would be in the AfterUpdate of the control:
Code:
Me![cmdPrint_Report].enabled = True

Now while leaving this form open the VBA code behind this Print_Report button would look like the following:
Code:
DoCmd.OpenReport "rptYourReportName"

The form must be kept open in the background until the report has finished. Then a closure of the form can take place.

Hopefully this gives you a start on how to set this up.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Please check out FAQ: faq702-639

This is a posting by Jim Lunde(a.k.a. JimmyTheGreek at TekTips) He is a calendar control that is by far one of the best that I have seen. Now requirement to register an ActiveX control. Just download and unqiz the file. Two calendar forms and a demo form. Just follow the instructions and you will be pleased with this item. Can be used freely without cost.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Thanks so much, Bob. Both for the great start to a set up for the calender, as well as, the flag to Jimmy.
Thanks, Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top