Rusty
Registered User.
- Local time
- Today, 10:59
- Joined
- Apr 15, 2004
- Messages
- 207
Hey Guys,
I have a form with a button that opens a report in preview mode containing data from the form.
I've coded it so a message box then appears asking the user if they want the print the report Yes/No and then export the report Yes/No.
This button/code works on all the other forms in the database (Access 2000) no problem but on this form (with the code below) the export works fine, but if I select "Yes" for the print option, it prints out the form and NOT the report.
Any ideas? I'm using "V" and "L" as the variables in the code for each of the forms, but would it be this that's causing the problem? Any ideas on a solution?
Rusty
:d
I have a form with a button that opens a report in preview mode containing data from the form.
I've coded it so a message box then appears asking the user if they want the print the report Yes/No and then export the report Yes/No.
This button/code works on all the other forms in the database (Access 2000) no problem but on this form (with the code below) the export works fine, but if I select "Yes" for the print option, it prints out the form and NOT the report.
Any ideas? I'm using "V" and "L" as the variables in the code for each of the forms, but would it be this that's causing the problem? Any ideas on a solution?
Rusty
:d
Code:
Private Sub btnPrintInvoiceRequest_Click()
On Error GoTo Err_btnPrintInvoiceRequest_Click
DoCmd.OpenReport "rptInvoice Request Form_study charges", acViewPreview, , ""
Dim VResponse As Integer
VResponse = MsgBox("Do you want to print this invoice now?", vbYesNo, "Print Invoice")
If VResponse = vbYes Then
DoCmd.PrintOut acSelection, 1, 1, , 1
Else
End If
Dim LResponse As Integer
LResponse = MsgBox("Do you want to export the report to Word?", vbYesNo, "Export to Word")
If LResponse = vbYes Then
DoCmd.OutputTo acOutputReport, "rptInvoice Request Form_study charges", acFormatRTF, , , ""
Else
End If
Exit_btnPrintInvoiceRequest_Click:
Exit Sub
Err_btnPrintInvoiceRequest_Click:
Resume Exit_btnPrintInvoiceRequest_Click
End Sub