Full Version: Bar Code Scanner inputed data - any ideas
UtterAccess Forums > Microsoft® Access > Access Forms
I have a form in which the serial number and the bar code are scanned from a scanner (duh). Ok, I need for the tab to jump to the next field once the info is scanned in. The bar code is always 12 char. so I simply put some coding (thanks to the help of UA) for it to go to the next field after the 12th char is entered. The problem is the serial number has no set pattern. I tried to do an "On Change" event, but it only read the first number scanned as if the scanner were inserting the date one char at a time.
Any ideas on how I should approace having it read all the characters and jump to the next field once entered w/ out knowing how long it's going to be?
Since there is no set format for this field, the Auto tab feature will not work.
You can manually hit the enter key on the keyboard or using some combination of OnChange with a Timer event to advance it after so long.
Depending on how your barcode is set up (most begin and end with an asterisk) you could also trap for that second asterisk and advance when this is entered.
Thanks. Tbe Barcode is fine, it's the serial number. Since diff manafacturers have diff char count, etc...on the serial numbers it's diff to make a rule.
What type of scanner do youi have, many can be programmed to autoinsert the carriage return at the end of a barcode.
I'm wanting to do a program in access to accept a barcode scan. Can you give me a few tips on how to do this
many thanks in advance
Most barcode scanners work through the StdInput, meaning that they will act in place of keyboard strokes. Thus setting up Access to accept barcode scans is no different than allowing any other program to accept them: you just need to correctly install the scanner's drivers (and other applications that come along with it). Once the scanner has been installed on your system, then whatever the scanner picks up in a barcode will be "typed" in whereever the cursor happens to be (aside from the enclosing *s).
You may also want to get barcode fonts for generating reports, etc. I know that there is a free true-type "Code 3-of-9" (or Code39) font out on the web. The trick with typing in something and having it become a usable barcode is that the barcode usually has some type of character encoded in the barcode that tells the scanner when the code begins and ends (usually *s). Thus you would have to type "*YourTextHere*" and then change the font to the Code 3-of-9 to get a usable barcode. Similarly, in queries, you may go with:
SELECT '*'&[SerialNumber]&'*' AS sn FROM MyTable WHERE condition=true
in order to tack on the enclosing *s around the field's value.
cheers for the feeback m8
so do you have access form displayed on the laptop / palmtop or whatever and then scan the article and it populates a field in access and then you automatically save it to the database
Sort of...
It will automatically fill in the control on the form, but it won't automatically fill in the field in the table nor will it automatically save the record unless you do some extra work behind the scenes.
The form just goes onto the computer of choice that has the scanner installed, and the control / field that you want filled in needs to have the cursor in it (in other words, the field must have the focus, so SetFocus to the desired field). If the input has a common style / format for each record, then apply a mask to that field in the database and then set the autotab = yes, so that scanning in the field will automatically advance the focus to the next field (or as patrick said before, if the scanning s/w attaches a carriage return to the end, this might advance the focus without using autotab for those fields that don't always have the same format). Then in the last field, instead of just advancing the focus (to the starting control on the form), you'd have to save the info on the form into your database. For this I use an "INSERT INTO MyTable" SQL query since I've worked with SQL databases more than I've worked with Access, but I'm thinking Access propably has some thype of SaveRecord function that you can call to do a similar action (some other guru would have to help you out with that). Another trick is instead of automatically saving the record after the last field is filled in, have a "Save Record" button on the bottom of the form, and then have the last field advance the focus to the button. Then when the user presses enter (or scans in a barcode (even the last one they just scanned) when the scanner attaches a carriage return at the end of the entry), the button will get "pushed" and the record will be saved. This might be a little better, since it allows the user to go back to fix any typos or other errors before saving the record.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.