Parameter Report problem

cyd44

Registered User.
Local time
Today, 05:13
Joined
Oct 30, 2011
Messages
85
I have a strange problem with a parameter driven report.

I have a form with 2 combo boxes (unbound) to select a report using the combo box values as a parameter. I also have a button to run the report without any parameter (to show all records).

The code used to run the report on combo box values are:-
Code:
DoCmd.OpenReport "BookViewReport", acViewReport, , "[" & "Location" & "]" & "=" & "'" & Location.Value & "'"
 
DoCmd.OpenReport "BookViewReport", acViewReport, , "[" & "Adventure" & "]" & "=" & "'" & cmbActivity.Value & "'"

The two commands shown above work perfectly but when I run the code to show all of the records the report shows the last query and not all records.
Code for the no paramter view is :-
Code:
DoCmd.OpenReport "BookViewReport", acViewReport

If I select the show all button for the firsttime, it works fine but if I choose a combo box selection and then go back to show all button, the report appears to retain the last query parameter.


How can I reset the pervious parameters to null in order to get all of the records.
 
Perhaps behind your command button you can add code to reset the combo box values to nul and also use a refresh command.

So behind the command button On Click Event you would have something like this (Change the comboBox names to your object names.

me.ComboBox1.Value=""
me.ComboBox2.Value=""
DoCmd.OpenReport "BookViewReport", acViewReport
 

Users who are viewing this thread

Back
Top Bottom