N
neenmarie
I'd like to use an "If" statement in the click event of a button - If the
user doesn't fill in fields on the form before clicking the button, a message
instructs them.
This is what I tried. My error keeps asking for an object. Can someone
help me please?
*********************************
Private Sub openSupplierReport_Click()
On Error GoTo Err_Command2_Click
If(forms!SubMenuA.RawPNDDList is null) then
MsgBox "Please select a Part Number"
ElseIf (Forms!SubMenuA.BegDate is null) then
MsgBox "Please enter a Beginning and Ending Date"
ElseIf (Forms!SubMenuA.EndDate is null) then
MsgBox "Please enter a Beginning and Ending Date"
Else
Dim stDocName As String
stDocName = "rptReceiveFromSupplierData"
DoCmd.OpenReport stDocName, acPreview
end if
Exit_openSupplierReport_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
*************************************************
user doesn't fill in fields on the form before clicking the button, a message
instructs them.
This is what I tried. My error keeps asking for an object. Can someone
help me please?
*********************************
Private Sub openSupplierReport_Click()
On Error GoTo Err_Command2_Click
If(forms!SubMenuA.RawPNDDList is null) then
MsgBox "Please select a Part Number"
ElseIf (Forms!SubMenuA.BegDate is null) then
MsgBox "Please enter a Beginning and Ending Date"
ElseIf (Forms!SubMenuA.EndDate is null) then
MsgBox "Please enter a Beginning and Ending Date"
Else
Dim stDocName As String
stDocName = "rptReceiveFromSupplierData"
DoCmd.OpenReport stDocName, acPreview
end if
Exit_openSupplierReport_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
*************************************************