Barcode Scanner Input - find Record

G

Guest

I have set up my form with a combo box so that the selection chosen brings up
the corresponding records.

If I have the input coming in from a barcode scanner, how do I set things up
so that the related record comes up?

Do I replace the combo box with a txt box and then progarm the afterupdate
event? or the ondirty event?

Any assistance with a solution appreciated. Thank you.
 
D

David W. Fenton

I have set up my form with a combo box so that the selection
chosen brings up the corresponding records.

If I have the input coming in from a barcode scanner, how do I set
things up so that the related record comes up?

Do I replace the combo box with a txt box and then progarm the
afterupdate event? or the ondirty event?

Yes, use an unbound textbox and the AfterUpdate event to load the
requested record (I'd assume the barcode encodes the PK value).
 
G

Guest

Cool, so I will put this in the afterupdate event and if the barcode input
has a hard return at the end it should come up bingo.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[barcodeID] = " & Str(Nz(Me![txtBardcode], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

?????

Thank you very much
 
A

Arvin Meyer [MVP]

You can use the AfterUpdate event of either a combo box or a text box. The
data entry from a barcode scanner is the same as from a keyboard. Depending
upon the scanner software, you may or may not have to use a carriage return
after the scan. For a search capability, you'd use an unbound control. For
data entry, use a bound control. The code should be the same as with
keyboard entry.
 
D

David W. Fenton

Cool, so I will put this in the afterupdate event and if the
barcode input has a hard return at the end it should come up
bingo.

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[barcodeID] = " & Str(Nz(Me![txtBardcode], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

?????

You need to know the format of the barcode. If it's got a checksum
in it, you need to know that. If your barcode reader transmits the
terminators you need to strip those out. The documentation for it
should tell you, but all you need to do is scan a barcode with known
value and then see what you get.

Your AfterUpdate would look something like this:

If Not IsNull(Me!txtBarcode] Then
With Me.RecordsetClone
.FindFirst "[barcodeID] = " & Me!txtBarcode
If .NoMatch Then
MsgBox "Not Found!"
Else
If Me.Dirty Then Me.Dirty = False
Me.Bookmark = .Bookmark
End If
End With
End If

The assumption is that BarcodeID is a numeric field, not a string,
but that's the way your original code put it.
 
T

Tony Toews

David W. Fenton said:
but all you need to do is scan a barcode with known
value and then see what you get.

David

Nice to see you over here.

Jeff

Just to add to David's posting you can scan the bar code into Notepad
to see what the scanner is doing.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
D

David W. Fenton

David

Nice to see you over here.

I've been bored. :)

Also, I'm trying to make sure that replication questions get covered
wherever they pop up, as there's hardly anyone left who knows how it
works. I'm working on a Jet Replication Wiki:

http://www.dfenton.com/DFA/Replication/

to try to get all the information about Replication organized in one
place. It's open to anyone who wants to create an account and make
changes, but so far, nobody but me has contributed. It's pretty
skimpy for now.

It would be fine if those without experience created sections for
issues they wanted explained.
 

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