Print and. Preview Command Buttons on a Report?

  • Thread starter Thread starter Elizabeth
  • Start date Start date
E

Elizabeth

If I add a command button to a report, there isn't any
option for adding code, such as an On Click event. Is
there another way to do this?

As it now stands, in my main menu I have a command button
to preview the report and another to print it, which
doesn't make sense. I don't want to have to create
another form with Print and Preview buttons for the
report! And I don't want to just use the Preview command
because the user would then have to know to click the
print button on the menu - something they won't be
familar with since they do everything else with buttons.

Many thanks,
Elizabeth
 
Elizabeth:

Standard windows procedures include previweing a report on the screen and
then clicking the print button to get it to print. Putting a button on a
report does not make much sense unless you want it to print out on the
report.

I have a 'menu' form that lists all my avaialbale reports. I have three
radio buttons at the top that allow the user to decide if they wish to email
the report, preview the report, or send the report straight to the printer.
It defaults to preview. Here is the code...

Option Compare Database
Option Explicit
Dim varRepName As String
Dim varMode As Integer


Private Sub PrintReports()

Select Case Me!OutputType
Case 1
DoCmd.OpenReport varRepName, acNormal
Case 2
DoCmd.OpenReport varRepName, acPreview
Case 3
DoCmd.SendObject acSendReport, varRepName, acFormatRTF, , , , , ,
True
End Select

DoCmd.Close acForm, "Switchboard - Reports"

End Sub




Private Sub DriverLicenseRept_Click()
varRepName = "Admin - License Expiration Alert"
PrintReports
End Sub

Private Sub PassportRept_Click()
varRepName = "Admin - Passport Expiration Alert"
PrintReports
End Sub

Private Sub NewEmplRept_Click()
varRepName = "Admin - New Employee Report"
PrintReports
End Sub
 
Thank you, Rick. Upon reviewing your code, it certainly
does make more sense to do as you suggested. I hadn't
thought about giving the user the email option - good
idea!
 
Back
Top