warehouseman
New member
- Local time
- Today, 09:58
- Joined
- Feb 17, 2006
- Messages
- 3
I'm new at Access so I'm learning - Thank you in advance. I have a form that is used to enter a new invoice. The form has a control for entering a PO number. The form is opened from a macro in the data mode "ADD". The records are retrieved from a query. on the form there is a subform that will show all PO and INVOICE records with that PO NUMBER. Before a invoice can be added I want to verify that a PO exist and if it does not I want to be able to display a message to that affect. I have tried to add the below code in the "Before Update" and also in the "After Update" in the PO NUMBER control as suggested by somebody - but all that happens is that it adds a new invoice record even if the PO NUMBER does NOT exist. What am I doing wrong or what should I be doing?
Private Sub PO_NBR_BeforeUpdate(Cancel As Integer)
If DCount("*", "Q_ADD_INV") = 0 Then
MsgBox ("No records there!")
End If
End Sub
Private Sub PO_NBR_BeforeUpdate(Cancel As Integer)
If DCount("*", "Q_ADD_INV") = 0 Then
MsgBox ("No records there!")
End If
End Sub