Crafty Way to Parse Barcode String Needed

M

Mike Thomas

In Access 2000, I have a form which accepts data from 3 barcodes on a label.

This first barcode has an ID which goes into the first textbox. The second
has an ID which goes into the second textbox.

The third barcode, however, contains several data items which need to be
parsed into 5 textboxes. Right now, I have made a third textbox which is
very small, almost invisible, and is locked. The third barcode goes into
that field, then is parsed out to the other five in the 'textbox3.lostfocus'
event. It works OK.

Is there a more elegant way to do this? Ideally, I'd like an invisible
textbox which would still be a tab stop and could accept data from the
scanner.

Thanks
Mike Thomas
 
R

Ron Weiner

I assume that the scanner is set up as a Keyboard Wedge. This is the
easiest way to set the scanner up but severely limits how you can acquire
data. However all is not lost. Since in Access the form itself can receive
and parse keystrokes, this might be the answer to your problem. Start
'foolin' around with your Forms OnKeyPress event after setting the forms
KeyPreview property to True. Without more information about what the data
looks like in the three barcodes I can't offer a more concrete suggestion.

In past projects I have always gone for direct control of the input device
(Bar Code or Mag Stripe readers), as I feel that using a keyboard wedge
makes you application easier to break when a barcode is scanned and the
focus is not where you intended it to be. It seems no matter how hard I
try, users always seem to find new and exciting ways to (mis)use my apps.
My favorite quote comes from the movie Jurassic Park, "Life always finds a
way".
 
J

John Nurick

Hi Mike,

There's no need to make the textbox particularly tiny: you can "hide" it
by putting it underneath some other control.

So the remaining problem is that users will find that tabbing from the
previous control causes the insertion point to disappear (into the
"hidden" textbox. Maybe you could do something like this in the form's
Current event procedure (warning: air code):

If Me.NewRecord
'We're entering data into a new record,
'so the barcode reader is probably in use.
'Enable the "hidden" third textbox so its tab stop works
'and the reader can inject data
Me.txtThirdBarCode.Enabled = True
Else
'We're viewing or editing an existing record.
Me.txtThirdBarCode.Enabled = False
End If
 

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