I am working on a simple database that only I will be using. I have a table for Invoices and a table for Payees. I have a form that opens to enter in new invoices as we get them with basic invoice specific information that then prints a check request based off the tempvar (Invoice number) I want to set up on my form a way to get a message box if the Payee is not currently in the database that says "New Payee, do you want to enter information?" If yes then open the "Payee details" form, complete their contact information, close that form and continue entering their invoice specific information. If no - then me.undo. I currently have this on the "Payee" field beforeupdate of the form:
Code:
[Code][Private Sub Payee_BeforeUpdate(Cancel As Integer)
Dim Answer As Variant
Answer = DLookup("[Payee]", "Payees Extended", "[Payee] <> '" & Me.Payee & "'")
If Not IsNull(Answer) Then
MsgBox "Payee Not found" & vbCrLf & "Please enter information.", vbInformation + vbyesno + vbDefaultButton1, "New Payee"
DoCmd.OpenForm! "Payee Details"
Cancel = False
Me.Undo
Else:
End If
End Sub][/Code]
I am still learning Access and VBA so any clear cut instructions or help would be GREATLY appreciated!
Thank you so much!