How can I execute a report if the combox "CbosupGPUser" is on Main Form "DepSlipMainFrm" and the command button "VDRCmd" is on Sub Form "DepSlipSubFrm"
I am using the following code and its not working
On Error GoTo Err_Handler
Const ReportName = "CDBRpt"
Const MESSAGETEXT = "No Bank Deposit ID # Selected."
Dim strCriteria As String
strCriteria = "[Deposit ID] = " & CbosupGPUser
If Not IsNull(Me.CbosupGPUser) Then
DoCmd.OpenReport ReportName, _
View:=acViewPreview, _
WhereCondition:=strCriteria
Else
MsgBox MESSAGETEXT, vbExclamation, "Invalid operation"
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error"
Resume Exit_Here
End Sub