I have a form where a user enters a start date and an end date in textboxes.
A report is created from a query using the start date and the end date entered
on the form as parameters. I created the report using the Wizard.
The form name is frmAdjustments.
The query name is qryAdjustments.
The report name is rptAdjustments.
How would I move the start date and the end date entered in the textboxes
to the report so the date range is displayed?
Can I use code to place the values in the text boxes of the form in textboxes or labels of the report?
For example: rptAdjustments.txtStartDate = frmAdjustments.txtStartDate.
The report is run when a View or Print button is selected. Could I place code in those click events
to do what I need?
Or...
Can I get the start date and the end date from the parameters directly from the query?
Is there a way to include the parameters in the SELECT statement to enable the report
to access them? Here is the query:
Code:
PARAMETERS [Forms]![frmAdjustments].[txtStartDate] DateTime,
[Forms]![frmAdjustments].[txtEndDate] DateTime;
SELECT [Hoods].[Fabric], [Hoods].[Degree], Sum([Transactions].[Adjustments])
AS Added,
Sum([Transactions].[AdjRemove]) AS Removed
FROM Hoods INNER JOIN Transactions ON [Hoods].[ID]=[Transactions].[BoxID]
WHERE ((([Hoods].[Fabric])<>'ALL'
And ([Hoods].[Fabric])<>'Other') And (([Hoods].[Degree])<>'ALL'
And ([Hoods].[Degree])<>'Other'))
And ((([Transactions].[TDate])>=[Forms]![frmAdjustments].[txtStartDate] And
[Transactions].[TDate])<[Forms]![frmAdjustments].[txtEndDate]+1))
GROUP BY [Hoods].[Fabric], [Hoods].[Degree];
I hope my question is clear. Basically, I want the two dates used as parameters to display at the top
of the report. The form, query, and report all work correctly.
Thanks for any suggestions.