Running Report from a Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there
I am not sure if this is the right forum if not please re-direct me to the
right one.

On a form I have an option group each option runs a report.

The reports are all the same but the query varies. Is there any way I can
just use one report but call a different query each time I run the report.

Sometimes the query may ask for a variable can this also be includes in the
running.

Thanks in advance for any help.

Graham
 
Yes. In the Open event of the report, check the value in the option group on
the form and assign the appropriate query to the report's RecordSource.

Example:
Select Case Forms!MyForm!MyOptionGroup
Case 1
Me.RecordSource = "Query1"
Case 2
Me.RecordSource = "Query2"
Case Else
'This may not be necessary with an option group
'as the source value for the Select Case
End Select
 
Back
Top