I know the answer to this is easy, but I need a little help. I’m trying to get a form to close if a customer is on COD basis or they have an approval# that is inactive. My code is as follows embedded in an AfterUpdate event.
Private Sub
If Me![Approval#] = "Inactive" Then
MsgBox "This Approval Number is Inactive. " _
& " Call the Lab Manager.", vbInformation
Cancel = True
DoCmd.Close
End If
If Me![BillingStatus] = "COD" Then
MsgBox "This Customer is a DEAD BEAT. " _
& " Call the Accounting Department or Plant Manager.", vbInformation
Cancel = True
DoCmd.Close
End If
End Sub
The problem is I get a runtime error:
The expression you entered refers to an object that is closed or doesn’t exist.
The text: ( If Me![BillingStatus] = "COD" Then ) is highlighted in yellow.
Any help is appreciated.
Private Sub
If Me![Approval#] = "Inactive" Then
MsgBox "This Approval Number is Inactive. " _
& " Call the Lab Manager.", vbInformation
Cancel = True
DoCmd.Close
End If
If Me![BillingStatus] = "COD" Then
MsgBox "This Customer is a DEAD BEAT. " _
& " Call the Accounting Department or Plant Manager.", vbInformation
Cancel = True
DoCmd.Close
End If
End Sub
The problem is I get a runtime error:
The expression you entered refers to an object that is closed or doesn’t exist.
The text: ( If Me![BillingStatus] = "COD" Then ) is highlighted in yellow.
Any help is appreciated.