W
Wendy Farkas
A listbox control on a form displays reports generated from parameter
queries. Clicking an "Open Report" button prompts the user to enter some
information, resulting in the appearance of an .rft document. Exciting!
(I want to get to the point where I can eliminate the button and have the
thing start right from double-clicking the listbox item, but I'll save that
for another post)
Behind the parameter prompt dialog box there is a Printing message box that
states "Now outputting blah-blah to the file yah-yah."
My question: how can I eliminate the appearance of that print status box?
My code:
'Output the selected report name to a Word file
Private Sub btnOpenRpt_Click()
On Error GoTo Err_btnOpenRpt_Click
DoCmd.OutputTo acOutputReport, Me.qmyrpt.Value, acFormatRTF,
("C:\Documents and Settings\All Users\Desktop\" & Me.qmyrpt.Value & ".rtf"),
True
Exit Sub
'Everything below here is Error handler stuff.
Err_btnOpenRpt_Click:
'Trap "Output To action cancelled" error (2501)
If Err.Number = 2501 Then
'Deal with action cancelled problem.
Dim ErrMsg As String
ErrMsg = "Report request cancelled."
MsgBox ErrMsg
End If
'Trap "Output To action cancelled" error (2487)
If Err.Number = 2487 Then
'Deal with action cancelled problem.
ErrMsg = "You must select a report before pressing the button."
MsgBox ErrMsg
End If
End Sub
queries. Clicking an "Open Report" button prompts the user to enter some
information, resulting in the appearance of an .rft document. Exciting!
(I want to get to the point where I can eliminate the button and have the
thing start right from double-clicking the listbox item, but I'll save that
for another post)
Behind the parameter prompt dialog box there is a Printing message box that
states "Now outputting blah-blah to the file yah-yah."
My question: how can I eliminate the appearance of that print status box?
My code:
'Output the selected report name to a Word file
Private Sub btnOpenRpt_Click()
On Error GoTo Err_btnOpenRpt_Click
DoCmd.OutputTo acOutputReport, Me.qmyrpt.Value, acFormatRTF,
("C:\Documents and Settings\All Users\Desktop\" & Me.qmyrpt.Value & ".rtf"),
True
Exit Sub
'Everything below here is Error handler stuff.
Err_btnOpenRpt_Click:
'Trap "Output To action cancelled" error (2501)
If Err.Number = 2501 Then
'Deal with action cancelled problem.
Dim ErrMsg As String
ErrMsg = "Report request cancelled."
MsgBox ErrMsg
End If
'Trap "Output To action cancelled" error (2487)
If Err.Number = 2487 Then
'Deal with action cancelled problem.
ErrMsg = "You must select a report before pressing the button."
MsgBox ErrMsg
End If
End Sub