Dave,
I presume the OptionGroup selects the specific report you want to print.
In that case, you can do the following:
1. Create the following enum at module level.
Private Enum PrintTypeEnum
PrintNormal = 1
PrintPreview = 2
PrintCancel = 0
End Enum
2. Create the following procedure in the form:
Public Function PrintReport(intAction As PrintTypeEnum)
Dim strReportName As String
If intAction = PrintTypeEnum.PrintCancel Then Exit Function
Select Case Me.optOptionGroup
Case 1: strReportName = "rptReport1"
Case 2: strReportName = "rptReport2"
Case 3: strReportName = "rptReport3"
Case 4: strReportName = "rptReport4"
Case 5: strReportName = "rptReport5"
Case 6: strReportName = "rptReport6"
Case Else: Exit Function
End Select
DoCmd.OpenReport strReportName, _
Choose(PrintTypeEnum.PrintCancel, _
acViewNormal, acViewPreview)
End Function
3. Then add the following to the OnClick property of the three buttons
(the property, not the event):
...to the [Print] button:
=PrintReport(1)
...to the [Print Preview] button:
=PrintReport(2)
...to the [Cancel] button:
=PrintReport(0)
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
Dave said:
I have an option group of 6 outside the frame there are 3 Cmd boxes ie,
print, preview, close.
I simply wish to preselect an option and Then click either say a "Print"
or
"Preview", "Send" etc (or for that matter cancel).
I have the option group set up, the Cmd boxes etc, But how do I get say
the
"Print" Cmd to print the preselected (report), say option 2 etc.??
Any help will be greatly appreciated
Dave