johnwiseman
MIS
Hi.
I use the following code on a command button to run reports which are selected from a populated list box. The code "me.preview.Value" selects whether the report is printed or previewed if a value is put in a tickbox called preview.
Private Sub butRunReport_Click()
On Error GoTo butRunReport_ClickErr
If Not IsNull(Me.Reports) Then
DoCmd.OpenReport Me.Reports, IIf(Me.Preview.Value, acViewPreview, acViewNormal)
End If
Exit Sub
butRunReport_ClickErr:
Select Case Err.Number
Case 2501
MsgBox "Report cancelled, or no matching data.", vbInformation, "Information"
Case Else
MsgBox "Error " & Err & ": " & Error$, vbInformation, "cmdOpenReport_Click()"
End Select
Resume Next
End Sub
I require help with the code where a file is not printed or previewed but exported to .rtf if another tickbox returns a value.
Thanks in advance for your help..
I use the following code on a command button to run reports which are selected from a populated list box. The code "me.preview.Value" selects whether the report is printed or previewed if a value is put in a tickbox called preview.
Private Sub butRunReport_Click()
On Error GoTo butRunReport_ClickErr
If Not IsNull(Me.Reports) Then
DoCmd.OpenReport Me.Reports, IIf(Me.Preview.Value, acViewPreview, acViewNormal)
End If
Exit Sub
butRunReport_ClickErr:
Select Case Err.Number
Case 2501
MsgBox "Report cancelled, or no matching data.", vbInformation, "Information"
Case Else
MsgBox "Error " & Err & ": " & Error$, vbInformation, "cmdOpenReport_Click()"
End Select
Resume Next
End Sub
I require help with the code where a file is not printed or previewed but exported to .rtf if another tickbox returns a value.
Thanks in advance for your help..