coding to ignore or block data in forms without an error message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to solve a problem with a barcoding system for tracking part location I have implemented. The barcoding system works as follows:
1. Scan Part # (barcode starts with the letter "A")
2. Scan Location (barcode starts with a number)

Both items 1 and 2 and entered onto the same form in access without any extra input from user. The problem I am trying to solve when the user accidentally scans the part # twice before scanning the location. Access is setup now to catch this error and pop up a message saying that the wrong type of data was inputted. However, due to the fact that we are using a wireless scanner away from the database, the user does not see this message and continues his/her job.

I wanted to try to set something up on the form where Access ignores the scan of barcodes beginning with the letter A on the control box and does not pop up an error. This way, the user can scan the part # as many times as he or she wants but the control box will not be filled in until the location is scanned. I don't know if this would be the best way to handle the issue but if anyone knew of any methods in access or coding that would work please let me know.

Thanks for your help!
-Jason
 
Use the BeforeUpdate Event on the Location control and setup the code to
check to see if it starts with a digit or not, and if it doesn't start with
a digit, then set the Cancel variable to -1 (True).

Example:

Private Sub tbxLoc_BeforeUpdate(Cancel As Integer)
Dim X as Integer
X = Asc(Left(Me.tbxLoc.Value,1))
If X < 48 or X > 57 Then
Cancel = -1
End If
End Sub

The above code will keep the focus in the textbox and will not update the
data to the table, should the test fail.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

jtd135 said:
I'm trying to solve a problem with a barcoding system for tracking part
location I have implemented. The barcoding system works as follows:
1. Scan Part # (barcode starts with the letter "A")
2. Scan Location (barcode starts with a number)

Both items 1 and 2 and entered onto the same form in access without any
extra input from user. The problem I am trying to solve when the user
accidentally scans the part # twice before scanning the location. Access is
setup now to catch this error and pop up a message saying that the wrong
type of data was inputted. However, due to the fact that we are using a
wireless scanner away from the database, the user does not see this message
and continues his/her job.
I wanted to try to set something up on the form where Access ignores the
scan of barcodes beginning with the letter A on the control box and does not
pop up an error. This way, the user can scan the part # as many times as he
or she wants but the control box will not be filled in until the location is
scanned. I don't know if this would be the best way to handle the issue
but if anyone knew of any methods in access or coding that would work please
let me know.
 
Back
Top