Generate a date in report from calender control

JPW

Registered User.
Local time
Today, 22:56
Joined
Nov 4, 2007
Messages
51
I have a report that is connected to a filter that is connected to two calender controls.

The user loads up the relevant form and choses a date from the 'Date From' calender control and then selects another date in the 'Date To' calender control and then presses a macro button which then generates a query/report that works perfectly well so far. All information I want and that I expect is there.

However, the user will most likely be selecting dates within a calender month so never will he/she do a for example 'Date From' - 17/03/08 to 'Date To 19/05/08.

I would like on the report for the report to show the relevant month of that report and year too. So if my user selects 'Date From' 01/02/08 to 'Date to' 21/02/08 then I'd like 'February 2008' to be displayed on my form in the header.

Is there a way to do such a function?
 
In your query you should have in your date fields criteria:
Code:
Between [Forms]![YourForm].[YourFormsStartDateTxtBox] And [Forms]![YourForm].[YourFormsEndDateTxtBox]

Then in a text boxes control source on your report put this to show the date that was chosen:
Code:
=Format(Forms!YourFormsName.YourFormsStartDateTxtBoxName,"mmmm dd yyyy") & " - " & Format(Forms!YourForm.YourFormsEndDateTxtBox,"mmmm dd yyyy")
Hope this helps.....
 
That works and when I go into print preview it appears as how I want it but when the report is actually printed, all I get is a 'Name?' message in the actual printout where it should be showing the date.
 
Like Rich said you have to have the form open. I open my reports maximized over top my form....:p

Code:
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
 

Users who are viewing this thread

Back
Top Bottom