Johnthelleader
Registered User.
- Local time
- Today, 01:13
- Joined
- Nov 8, 2006
- Messages
- 27
I have a popup form called ADD NEW INVOICE that a user enters invoice data. This gets stored in the table INVOICES. Users can then view the invoices already entered in the form INVOICES. The first field in the popup form , INVOICE NUMBER, has a Before Update function that warns the user if an invoice number has already been entered. This works fine. What would be great is to then display that invoice that has already been entered in a new form. I have used some code using Bookmark, but it did not work. I have tried to find it in this forum, but to no avail. I would be grateful for any help. This is the code I already have:
Private Sub Invoice_Number_BeforeUpdate(Cancel As Integer)
On Error GoTo Invoice_Number_BeforeUpdate_Err
If (DCount("[Invoice Number]", "Invoices", "[Invoice Number]=Forms![Add new Invoice]![Invoice Number]"))
Then MsgBox "This Invoice Number has already been entered. Please check the invoice.", vbInformation, "Duplicate Invoice Number"
Invoice_Number_BeforeUpdate_Exit:
Exit Sub
Invoice_Number_BeforeUpdate_Err:
MsgBox Error$
Resume Invoice_Number_BeforeUpdate_Exit
End Sub
Points to note. Invoice number is stored as a text field in the Table and it is also a Primary Key.
Private Sub Invoice_Number_BeforeUpdate(Cancel As Integer)
On Error GoTo Invoice_Number_BeforeUpdate_Err
If (DCount("[Invoice Number]", "Invoices", "[Invoice Number]=Forms![Add new Invoice]![Invoice Number]"))
Then MsgBox "This Invoice Number has already been entered. Please check the invoice.", vbInformation, "Duplicate Invoice Number"
Invoice_Number_BeforeUpdate_Exit:
Exit Sub
Invoice_Number_BeforeUpdate_Err:
MsgBox Error$
Resume Invoice_Number_BeforeUpdate_Exit
End Sub
Points to note. Invoice number is stored as a text field in the Table and it is also a Primary Key.