HomeGrowth
Technical User
all of suddenly, I got this error 'Invalid procedure call or argument' when I click on a few preview button on reports. The preview button codes are just the standard codes setup with the wizard, and I added the stFilter.
Private Sub cmdPreviewRpt_Click()
On Error GoTo Err_cmdPreviewRpt_Click
Dim stDocName As String
Dim stFilter As String
Dim strOption As String
strOption = Me.optTypeOfRecords
Select Case strOption
Case Is = 1
stFilter = "[StabilityDocStatus] Like 'Active/Approved'"
Case Is = 2
stFilter = "[StabilityDocStatus] Like 'Inactive*'"
Case Is = 3
stFilter = ""
End Select
stDocName = "rpt_StabilityProtocol_rpt"
DoCmd.OpenReport stDocName, acViewPreview, , stFilter
Exit_cmdPreviewRpt_Click:
Exit Sub
Err_cmdPreviewRpt_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewRpt_Click
End Sub
I check the references, they are in this order:
Visual Basic For Application
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft DAP 3.6 Object Library
Microsoft ActiveX Data Object 2.1 Library
My Laptop that I used to develop the program works without error. Any suggestion what else need to check? Thank you.
HG
Private Sub cmdPreviewRpt_Click()
On Error GoTo Err_cmdPreviewRpt_Click
Dim stDocName As String
Dim stFilter As String
Dim strOption As String
strOption = Me.optTypeOfRecords
Select Case strOption
Case Is = 1
stFilter = "[StabilityDocStatus] Like 'Active/Approved'"
Case Is = 2
stFilter = "[StabilityDocStatus] Like 'Inactive*'"
Case Is = 3
stFilter = ""
End Select
stDocName = "rpt_StabilityProtocol_rpt"
DoCmd.OpenReport stDocName, acViewPreview, , stFilter
Exit_cmdPreviewRpt_Click:
Exit Sub
Err_cmdPreviewRpt_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewRpt_Click
End Sub
I check the references, they are in this order:
Visual Basic For Application
Microsoft Access 11.0 Object Library
OLE Automation
Microsoft DAP 3.6 Object Library
Microsoft ActiveX Data Object 2.1 Library
My Laptop that I used to develop the program works without error. Any suggestion what else need to check? Thank you.
HG