bob fitz
AWF VIP
- Local time
- Today, 11:05
- Joined
- May 23, 2011
- Messages
- 4,722
I am trying to use the following code to open a report in preview but I get the following error message:
I do not have a report called "Custom rpt" that is mentioned in the error message.
Does anyone have any ideas about what might be wrong here?
The error occurs at line 30.Microsoft Access cannot find the object 'Custom Rpt.'
I do not have a report called "Custom rpt" that is mentioned in the error message.
Code:
Private Sub cmdRpt_Click()
10 On Error GoTo Err_cmdRpt_Click
Dim stDocName As String
20 stDocName = "rptReceipts"
30 DoCmd.OpenReport stDocName, acPreview, , "CoNameID = " & Me.cmbFindCo
Exit_cmdRpt_Click:
40 Exit Sub
Err_cmdRpt_Click:
50 Debug.Print Err.Description
60 If Err.Number = 2501 Then
70 Resume Exit_cmdRpt_Click
80 Else
90 Call ErrorLog(Err.Number, Err.Description, "cmdRpt_Click()", "frmReceipts", Erl, True)
100 Resume Exit_cmdRpt_Click
110 End If
End Sub