Barcode question?

L

ldiaz

I have this code to find a record on the table and show it on the form, but
to make this operation I need to press ENTER key after scan the barcode where
the scanner place the data on a textbox named: ScanWO,
how can I do after to scan the barcode the access make this operation
without press Enter Key, please help..

===================================================
Private Sub ScanWO_AfterUpdate()

On Error GoTo Err_ScanWO_Click

'To get only WOs
WOnumber = Mid([ScanWO], Len([ScanWO]) - 17, 7)


'To find the record stored in the DispatchTable
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[WO_ID] = " & WOnumber
If Not rs.EOF Then Me.Bookmark = rs.Bookmark



Exit_ScanWO_Click:
Exit Sub

Err_ScanWO_Click:
'MsgBox Err.Description
'Messaje omited
'created new message when the WO does not exist
MsgBox "Error, please check if the WO scanned is on the DB!",
vbCritical, "Error, WO not found!"



Resume Exit_ScanWO_Click
End Sub
===================================================
 
S

strive4peace

Hi Lorenzo,

many scanners have an option to include a TAB or ENTER after a code is
scanned ... check to see if yours has that feature and let the scanner
add it

Warm Regards,
Crystal

*
:) have an awesome day :)
*
 
M

m3

Instead of using the AfterUpdate event, try using OnChange event.

Private Sub ScanWO_Change()
'1) Check to see if you have received a complete barcode.

IF Len(ScanWO) < TheTotalLengthOf YourBarcode THEN EXIT SUB

'2) If all digits of the barcode is received, setup ScanWO for proecssing
ScanWO.Value = ScanWO.Text

'Your code follows....

On Error GoTo Err_ScanWO_Click

'To get only WOs
WOnumber = Mid([ScanWO], Len([ScanWO]) - 17, 7)

'To find the record stored in the DispatchTable
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[WO_ID] = " & WOnumber
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Exit_ScanWO_Click:
Exit Sub

Err_ScanWO_Click:
'MsgBox Err.Description
'Messaje omited
'created new message when the WO does not exist
MsgBox "Error, please check if the WO scanned is on the DB!",
vbCritical, "Error, WO not found!"
Resume Exit_ScanWO_Click
End Sub
 
M

m3

Sorry the Check length of barcode received code should be change from ..

IF Len(ScanWO) < TheTotalLengthOf YourBarcode THEN EXIT SUB

to

IF Len(ScanWO.Text) < TheTotalLengthOf YourBarcode THEN EXIT SUB

My mistake!

m3 said:
Instead of using the AfterUpdate event, try using OnChange event.

Private Sub ScanWO_Change()
'1) Check to see if you have received a complete barcode.

IF Len(ScanWO) < TheTotalLengthOf YourBarcode THEN EXIT SUB

'2) If all digits of the barcode is received, setup ScanWO for proecssing
ScanWO.Value = ScanWO.Text

'Your code follows....

On Error GoTo Err_ScanWO_Click

'To get only WOs
WOnumber = Mid([ScanWO], Len([ScanWO]) - 17, 7)

'To find the record stored in the DispatchTable
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[WO_ID] = " & WOnumber
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Exit_ScanWO_Click:
Exit Sub

Err_ScanWO_Click:
'MsgBox Err.Description
'Messaje omited
'created new message when the WO does not exist
MsgBox "Error, please check if the WO scanned is on the DB!",
vbCritical, "Error, WO not found!"
Resume Exit_ScanWO_Click
End Sub

ldiaz said:
I have this code to find a record on the table and show it on the form,
but
to make this operation I need to press ENTER key after scan the barcode
where
the scanner place the data on a textbox named: ScanWO,
how can I do after to scan the barcode the access make this operation
without press Enter Key, please help..

===================================================
Private Sub ScanWO_AfterUpdate()

On Error GoTo Err_ScanWO_Click

'To get only WOs
WOnumber = Mid([ScanWO], Len([ScanWO]) - 17, 7)


'To find the record stored in the DispatchTable
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[WO_ID] = " & WOnumber
If Not rs.EOF Then Me.Bookmark = rs.Bookmark



Exit_ScanWO_Click:
Exit Sub

Err_ScanWO_Click:
'MsgBox Err.Description
'Messaje omited
'created new message when the WO does not exist
MsgBox "Error, please check if the WO scanned is on the DB!",
vbCritical, "Error, WO not found!"



Resume Exit_ScanWO_Click
End Sub
===================================================
 
R

Rick Brandt

ldiaz said:
I have this code to find a record on the table and show it on the
form, but to make this operation I need to press ENTER key after scan
the barcode where the scanner place the data on a textbox named:
ScanWO,
how can I do after to scan the barcode the access make this operation
without press Enter Key, please help..

Most scanners can be configured to automatically output either an <enter> or
<tab> after each scan. That is how all of ours work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top