Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Microsoft: Access Forms FAQ

How to

Print Reports Using Option Group by Garridon
Posted: 13 Jun 02 (Edited 27 Jun 02)

You may want to use an option group (radio buttons) to print or preview reports.  This method will allow you to add two buttons, one for Previewing and one for Printing, giving your users an option of what they want to do.

Create an option group using the wizard.  Keep track of each report, as well as the corresponding option button number Access assigns to it.  You'll need it for the next step.  In the properties of the option group, under the Other Tab, Name property, called it fraPrint.

Create a button for Previewing the reports.  For the button's On Click event procedure, add the following code.  The "Case is = #" should correspond to the the numbers Access assigned to each of your options.

Private Sub cmdPreview_Click()
On Error GoTo ErrorPreview

Select Case [fraPrint]

    Case Is = 1
        DoCmd.OpenReport "rpt1", acViewPreview
    Case Is = 2
        DoCmd.OpenReport "rpt2", acViewPreview
    Case Is = 3
        DoCmd.OpenReport "rpt3", acViewPreview
    Case Is = 4
        DoCmd.OpenReport "rpt4", acViewPreview

' If you don't chose a default value, this generates a message box if the user clicks a button without making a selection

    Case Else
        MsgBox "Select Report", vbExclamation, "Reports"

End Select

    Exit Sub
    MsgBox err.Description   
    Resume ExitPreview
End Sub

To Print reports as well, just add a print button.  Paste the same code in, but change the acViewPreview to acViewNormal.

Back to Microsoft: Access Forms FAQ Index
Back to Microsoft: Access Forms Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close