printing a report with VBA

J

JMG

Help!

I have created a report but once the report is produced, I would like to
give the user the option to print, and then export the report. I have created
the following code but I am not sure when to embed it.

strtitle = "name of the report"

printdoc = MsgBox("Would you like to print the report?", vbYesNo, "Print!")

If printdoc = 6 Then
DoCmd.Print "report1"
Else
End If

Exreport = MsgBox("Would you like to export the report to Excel?", vbYesNo,
"Export the Report?")
If Exreport = 6 Then
DoCmd.OutputTo acOutputReport, "report1", *.xls, strtitle
Else
End If

Clreport = MsgBox("Would you like to prepare another report?", vbYesNo,
"Create Another Report")
If Clreport = 6 Then
DoCmd.Close acReport, "report1", acSaveNo
DoCmd.OpenForm "form6"
Else
DoCmd.Close acReport, "report1", acSaveNo
DoCmd.OpenForm "intro"
End If
 
Top