Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command button: use option and command buttons together

Status
Not open for further replies.

Fredgarner

Technical User
Jul 21, 2005
29
GB
I would like to deisgn a form which gives the option of printing or previewing (ie 2 choices = 2 command buttons)a choice of 3 reports (ie 3 choices). I would like to be able to highlight the report I want to print by using 3 option buttons - I know how to create a command button that either prints or previews a report, but not how to use the option buttons to link these 2 command buttons to 3 separate reports. At the moment I am having to use 6 command buttons for this operation.
 
You can reference the variable of the option group and code within the command button an If Statement... ie.

If Opt_Reports = 1 Then
lcReportName = "ReportName1"
ElseIf Opt_Reports = 2 Then
lcReportName = "ReportName2"
ElseIf Opt_Reports = 3 Then
lcReportName = "ReportName3"
Else
lcReportName = "" 'Force Error
End If

Once you have variable, use that when calling either print of preview.. hthw,

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top