Help with barcode form

woknick

Registered User.
Local time
Today, 12:17
Joined
Sep 25, 2004
Messages
85
I have built a Barcode scanning program and Im having trouble with a part of the functionality.

What it is supposed to do: A user will scan a barcode and that number is stored into a table if it is unique. If it is not unique then I want to open a new form.

This is the code I have for the text field, which uses a query to search for the entered value.

Private Sub Form_BeforeUpdate(Cancel As Integer)
[txtTest] = DLookup("[Barcode Number]", "SearchNew")
If IsNull(txtTest.Value) Then
'add record

Else
'Open another form and ask for user input


I keep getting a error message from access about it being a duplicate

How do I bypass this message.

Thanks in advance
 
I assume you are getting this error when the record is not unique.
you need to add the line
cancel = true
to your "else" side of the if statement so that it prevents the form from updating

peter
 

Users who are viewing this thread

Back
Top Bottom