The Problem Im having is that when I enter a value in the txtBarcode, Access adds that barcode to the table BarcodeList before I get a chance to search for the barcode.
I want to be able to take the number entered in the text box and check the table first before updating the record
Whats happing now is that when I press enter on the form access saves the current value and then searches for the value it just entered. Of course it is going to find it because it just added it.
Private Sub txtBarcode_Exit(Cancel As Integer)
Dim varX As Variant
Cancel = True
varX = DLookup("[Barcode Number]", "BarcodeList", "[Barcode Number] = '" _
& txtBarcode.Text & "'")
If IsNull(varX) Then
'add record
Else
txtTest.Value = txtTest
txtBarcode.Value = " "
txtBarcode.SetFocus
DoCmd.OpenForm ("WARNING")
PLEASE HELP
THANKS NICK
I want to be able to take the number entered in the text box and check the table first before updating the record
Whats happing now is that when I press enter on the form access saves the current value and then searches for the value it just entered. Of course it is going to find it because it just added it.
Private Sub txtBarcode_Exit(Cancel As Integer)
Dim varX As Variant
Cancel = True
varX = DLookup("[Barcode Number]", "BarcodeList", "[Barcode Number] = '" _
& txtBarcode.Text & "'")
If IsNull(varX) Then
'add record
Else
txtTest.Value = txtTest
txtBarcode.Value = " "
txtBarcode.SetFocus
DoCmd.OpenForm ("WARNING")
PLEASE HELP
THANKS NICK