I have a calendar control on a form so the user can select start and end dates for a report. In the after_update event of the calendar it puts the dates in text boxes, format dd-mm-yyyy. This part works fine.
But when the user loads the report (which should use these dates) the report loads data for all dates, whether they are inside the range or not.
But when I double click the query it asks me to input these parameters and then gives me the desired data, so my problem is somehow the form is not sending the proper parameters to the report, and the report is not asking for the right parameters.
Here's the code to generate the report:
And here's the query the report is built on:
forms!frmCalendar.data_inicio and ...final do hold a text string in the format dd-mm-yyyy at the time the report is called.
Can anyone help me out with this?
But when the user loads the report (which should use these dates) the report loads data for all dates, whether they are inside the range or not.
But when I double click the query it asks me to input these parameters and then gives me the desired data, so my problem is somehow the form is not sending the proper parameters to the report, and the report is not asking for the right parameters.
Here's the code to generate the report:
Code:
Private Sub cmdACCEPT_Click()
DoCmd.OpenReport "conRelatório", acViewPreview
End Sub
And here's the query the report is built on:
Code:
SELECT [OK_PEÇAS].[SEQUENCE], [OK_PEÇAS].[CUSTOMPN], [OK_PEÇAS].[ESQUERDO], [OK_PEÇAS].[DIREITO], [OK_PEÇAS].[DATA]
FROM OK_PEÇAS
WHERE [OK_PEÇAS].[DATA] Between cdate([forms]![frmCalendar].[DATA_inicio]) And cdate([forms]![frmCalendar].[DATA_final]);
forms!frmCalendar.data_inicio and ...final do hold a text string in the format dd-mm-yyyy at the time the report is called.
Can anyone help me out with this?