Tranferring criteria data to report

rick roberts

Registered User.
Local time
Today, 14:02
Joined
Jan 22, 2003
Messages
160
i have a report that gets its data from a query -between two dates
Between [Start Date (Inclusive)] And DateAdd("d",7,[Start Date (Inclusive)])
this works fine but what i want to do is place the chosen dates from the criteria results onto the report itself ie. if i typed in 01/01/09 it would give me data from 01/01/09 to 07/01/09 - i want those dates to appear on my report header - any ideas? thanks in anticipation
ps the dates of each transaction do appear in the report as text boxes -- ive thought of picking out the lowest and highest of these dates but if i have a blank day then that would cause issues
 
Put something like this code in the Report Load event; where there are 2 txtboxes to show your date range. In my example, the dates are coming from a form FP-Dates. In your query, the criteria would also refer to the Forms Dates. The form needs to be Dialog and a usually a Pop-Up. When the dates have been selected, you press a button to set the form's Visible = False and open your report. You will need to close FP-Dates with a simple

Private Sub Report_Load()
Me.txtPeriod.Value = Format(Forms![FP-Dates].[txtStartDate].Value, "Medium Date") & " to " & _
Format(Forms![FP-Dates].[txtEndDate].Value, "Medium Date")
End Sub

Private Sub Report_Activate()
DoCmd.Close acForm, "FP-Dates"
End Sub
 
just what i wanted -- works great - but i think ill adjust it somewhere so that i only have to give the opening date and let it work out 7 days from there itself either at the query level or the report vb - thanks for setting me up on the right track
oh you mentioned setting the form up as dialog -- where do i find that option?
 

Users who are viewing this thread

Back
Top Bottom