Run Code without Keyboard Strokes?

M

Mike

Hi,
I want to add code to have MS Access automatically trigger
the keyboard "Enter Key" command when the user populates a
data field. I have a bar code scanner attached to the pc
and the user will scan the barcode which will be populated
into a data field I have on the access form. Now, instead
of the user pressing the "Enter Key" on the keyboard or
clicking on a button after scanning the barcode, I want
to call a function to trigger the enter key on the
keyboard so I can display the info for that scanned
barcode.


Thanks,
 
M

Mal Reeve

You can use the KeyPress property (or keyDown,,,or KeyUp)
and perhaps test for how long the entry is..
eg.
If Len(TheField) = 6 then (or whatever length it is supposed to be when
'done' )
** Put whatever you need here to go to the next field like...
me.TheNextField.setfocus
or **
If hitting enter is the same as clicking on a button,
use the name of t the button event to trigger it here
btnAddAnotherRecord
end if

Avoid using SendKeys as that can cause other problems.

HTH
Mal.
 
B

Bob Lounsbury

Most barcode scanners can be configured to insert a postamble
following the barcode data. It is very common to have the scanner
send a CR/LF, giving the computer the impression that the user has
pressed the enter key. Somewhere in the scanner's manual you should
find some configuration barcodes, including one titled "insert CR/LF
after data" or something like that.

Bob

Bob Lounsbury
The Barcode Software Center
www.makebarcode.com
 

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