Bar Code commands

  • Thread starter Thread starter DEVOURU
  • Start date Start date
D

DEVOURU

Any ideas on having bar codes execute form commands? Such as requery form,
close form, next, prev.

Thankx in advance.

-JS
 
Sure, why not? Simply have the AfterUpdate event of the text box into
which the barcode goes analyze the barcode and execute the code of your
choice using a SELECT statement.
I personally wouldn't find it very useful to scan barcodes simply to
advance to the next record. The mouse works very well for that :-)

Pavel
 
The application for this is to have a sheet metal fabrication floor scan
from a report of bar coded purchase order numbers and the qty completed. On
a seperate sheet of paper are system commands to open, close, next, delete,
new, whatever common commands i feel should be available.

-JS
 
Aha, this makes sense. In the environment like this it sounds like a
good solution. I take my words back.

Pavel
 
It appears this is not as simple as I thought it may be. Is there a code
that could be scanned to execute a button?

-JS
 
A barcode scanner (at least those I used) inserts a Tab, if used as a
keyboard wedge, after the barcode information. I think you should use
AfterUpdate event of the barcode text box to carry out the commands you need.
This way, once the barcode is read, the tab inserted by the scanner will
force the update of the text box, which will fire up the AfterUpdate
event. The event should have the code you need executed, in a CASE
SELECT statement.
Any barcode can call anything you'd like - it is up to you to decide.
Say, "FW01" can be Forward record, "BK01" could be back a record, "SV01"
could be Save a record (assuming you use encoding supporting alpha
chars). Then, you simply compare the codes read with those you specify
in the CASE statement, and if they match, you move forward, backward,
save record, etc.
I think you should not attempt to "call" event "click" method directly,
but instead put the code from the button "click" event into a private
procedure for the form, then re-use it in the barcode text box's
AfterUpdate event.

Pavel
 
There are two ways to do what you want to do depending on what type of
bar code scanner that you have. If you have a "keyboard wedge" type
scanner then you would need to encode commands into bar codes using a
syntax that you define so that commands are not confused with bar code
data. For example, you might enclose all commands in brackets and
leave actual bar code data un-bracketed.
As the last message in this thread recommended you would use code in
the AfterUpdate event for the textbox to examine the data in the
textbox and determine whether the data is a command or actual data. If
it is a command then use a Select Case statement to determine what
command to implement.

For example:

Private Sub Text0_AfterUpdate()
Dim MyText As String
MyText = Text0.Text
If Left(MyText, 1) = "{" And Right(MyText, 1) = "}" Then
' data just scanned was a command
Select Case UCase(MyText)
Case "{NEXTREC}"
' put code here to move to the next record
Case "{PREVREC}"
' put code here to move to the previous record
Case "{BEEP}"
MsgBox "beep"
End Select
Else
' the bar code that was scanned was not a command
' put code here to handle the actual bar code data
' that are not special commands
End If
End Sub

If you have a scanner that has an RS232 serial interface, you could do
things several other ways. With a RS232 scanner, you could use a
Software Wedge like WinWedge from TAL Technologies to pass all bar
code data directly to a Access subroutine using Dynamic Data Exchange
(DDE) and have the subroutine process the data directly using similar
logic in the above sample code.
You could also encode commands using ASCII control codes and then use
the character to keystroke translation table in the Software Wedge to
convert each specific ASCII control code received from the bar code
scanner to specific keystrokes that would implement the command by
issuing the correct keystrokes to the form. For example, suppose that
you encode an ASCII 1 in your bar code and you want that character to
represent a ALT - N keystroke on your form. You could translate the
ASCII 1 character in the Software Wedge to an ALT - N keystroke and
then when you scan the bar code while the form has the focus, the
Software Wedge would generate the ALT - N keystroke when you scan the
bar code containing the ASCII 1 character.

For more detailed information on WinWedge please visit:
http://www.taltech.com/products/winwedge.html
 
Back
Top