Use a button.
On the button On Click Event put this sort of code:
'====================Code Starts===
Dim stDocName As String
Dim stParameter As String
Dim stLinkCriteria As String
stDocName = "rptYourReportName"
stParameter = Forms![HistoricTransfer]![parmResume]
stLinkCriteria = "[QueryField] = " & "'" & stParameter & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'====================Code Ends===
Actually, you should have one generic query with no paramters, and one generic report based on that query. Then use buttons to pass paramters to the report - and thus to the query.
I have a database with more than 300 reports, all based on two queries and two reports, but different parameters are passed on each button. I also use Combo boxes to select criteria. When using Combo Boxes to pass criteria, make sure the proper column is bound for the parameter being passed.
I hope this helps.
mmcdonal
|