Fun with Barcode scanner....

I got it. It works without the brackets. However, my theory must be incorrect. It still doesn't work. I'll have to live with the user having to press one more button to get to the form.

If I could find the setting that turns off choosing an item in the drop-down with the keyboard it would work.

This thread has helped me to clarify the problem at least. For some reason, when the barcode reader puts the asset number into the field, the combo box is using the first character to choose the first item that starts with that character. Most of the barcodes (asset numbers) start with the number 1. When the barcode is scanned, as soon as that field gets the number 1 it chooses that first item.

If I don't use the barcode scanner and just type the number 1 in the field with the keyboard, it does the same thing. It doesn't wait for me to type the rest of the number (10449 for example) it just executes the code based on the first item in the dropdown that starts with 1. When I remove the sendkey command from the code it lets me type the whole number but then I have to press Enter or Tab to get the form to open.
 
why do you need to use the combobox anyway?

if you just used the txtbox then in the txtbox onchange event you would use the following - myTable is the table referred to in your combobox rowsource, myType is whatever is in column 1 and Barcode is whatever is in column 0:

Code:
Select Case Dlookup("myType","myTable","[Barcode]='" & txtbox.text & "'")
Case "AmmoniaDetector"
DoCmd.OpenForm "AmmoniaDetectorRoundF"
...
...
Case Else
    msgbox "Code not found"
End Select
...
 
I used the combobox because I've used it to do other lookups and I never knew I could use a textbox for this:D.

I can see that it would solve the problem because there isn't a drop-down list to get in the way. Now I just need to figure out how to adjust what you wrote for my situation. I created a new textbox (txtTypeLookup) to test with and here is what I've got so far:

Private Sub txtTypeLookup_AfterUpdate()
Select Case DLookup("EquipmentTypeAssetNumberT.Type", "EquipmentTypeAssetNumberT", "[AssetNumber]='" & txtTypeLookup.Text & "'")
Case "AmmoniaDetector"
DoCmd.OpenForm "AmmoniaDetectorRoundF"
Case "Compressor"
DoCmd.OpenForm "NorthCompressorRoundF"
Case "Subcooler"
DoCmd.OpenForm "NorthSubcoolerRoundF"
Case "Purger"
DoCmd.OpenForm "NorthPurgerRoundF"
Case "AirCompressor"
DoCmd.OpenForm "NorthNCRAircompressorRoundF"
Case "EvapUnit"
DoCmd.OpenForm "NorthEvapUnitRoundF"
Case "Condenser"
DoCmd.OpenForm "NorthCondenserRoundF"
Case "Chiller"
DoCmd.OpenForm "NorthChillerRoundF"
Case "Vessel"
DoCmd.OpenForm "NorthVesselRoundF"
Case Else
MsgBox "Code not found"
End Select
End Sub

This is almost there! I changed it to AfterUpdate because OnChange only accepted one character before it did the lookup. Now all that is left is to get it to open the form automatically. It puts in the barcode but I need to press enter to get it to open the form. I think it would work if I could find a way to get OnChange to work correctly.
 
When you scan a barcode, it will paste all the characters to txtTypeLookup in one go so there is only one change event on the paste. Using the afterupdate event means the user needs to click elsewhere on the form to update the field.

To mimic the barcode scanner if you do not have one attached, type the assetnumber into somewhere else - notepad for example, then copy it and paste it into txtTypeLookup - and set your code to the change event.

If this is not working, it implies the scanner is sending one character at a time so it may be something to do with the scanner setup. I've used them many times and have never had a problem
 
I also see from your code that you have

EquipmentTypeAssetNumberT.Type

Type is a reserved word and it can produce unexpected results if used as a field, control or object name. I strongly recommend you rename this to something else like AssetType - it may be why you are having problems

Here is a link to words you should not use

http://office.microsoft.com/en-gb/a...7-reserved-words-and-symbols-HA010030643.aspx
 
I changed the field name to AssetType. Looking at that list, there sure are alot of reserved words!

I'm going to contact the tablet vendor. OnChange works great when I paste the entire number into the field but when I use the barcode scanner it stops at the first number. It must be entering the numbers one at a time which doesn't make much sense. These are Motion Tablets if you are familiar with them. They have a built-in barcode and RFID scanner.

You've been a great help. Thanks again!

Steve
 
Hmm, not heard of those, I've just used the standard barcode reader connected via usb cable.

If it is one character at a time and your asset numbers are all the same length then you could modify your onchange code to:

Code:
Private Sub txtTypeLookup_AfterUpdate()
 
    if len(txtTypeLookup.Text)=6 then 'or whatever length your code is
        Select Case DLookup("EquipmentTypeAssetNumberT.Type", "EquipmentTypeAssetNumberT", "[AssetNumber]='" & txtTypeLookup.Text & "'")
            Case "AmmoniaDetector"
            ....
            ....
    end if
end sub
 
It figures, most are 6 but some are 5.

I'll see what the vendor says about the barcode reader.

Steve
 
I found a configuration file for the barcode scanner. I could set it to enter a carriage return after the barcode is read which would make on_Update work better. Unfortunately, I need admin rights to edit the configuration file. I'll have to call our helpdesk to get the proper permissions. Then if it works, it will need to be changed on all the tablets in order to work.
 
The config file is a text file that is manually edited. I saw some configuration changes in the vendors' knowledgebase that use barcodes to make the change but I think this one needs to be manual though.
 
It works! I had to set the scanner to add an "Enter" keystroke after the barcode and used the After_Update event to trigger the lookup. Now it opens the correct forms.

Thanks again!

Steve
 
These tablets have a barcode and RFID scanner built-in. I'm just using the barcode scanner so machine operators can approach a machine, scan the barcode and Access will pull up a navigation form related to that machine type.

I don't know much of anything about RFID scanners but I suspect that it's much harder (and more expensive) to make your own RFID tags. I also don't know how close you need to be for it to pick up the tag information.

The tablets we are using (Motion C5) are ruggedized so that they can survive the occasional drops, bumps and water splashes without dying prematurely. They are a bit heavy and the stylus is quite finnicky. They also don't have a built-in hardware keyboard. We'll soon have some touchscreen models to try out. It goes without saying that they are also much more expensive than most laptops.

You don't need special software to use the barcode scanner. There is a driver and a configuration program but other than that you can use the scanner with any software. I just found out from the vendor today that it uses the "Keyboard buffer" to enter the code wherever the cursor is on the screen. You press a button, shine the red light on a barcode and it chimes when it's read it.
 
Hi Steve

I am looking at doing what you sound to have suceeded in doing. Was wondering if you have yours fully operational and if you would consider posting a sample. We to are using the Motion Slates as well.

Regards
Sil
 
Hi Sil,

The barcode scanner is the easy part. On the Motion tablet you just press the barcode button, point it at the barcode and it will put whatever number is in the barcode wherever the cursor is at that moment. I did learn that the tablet uses the "keyboard buffer" to enter the barcode after it is read. This may be important to know as it doesn't "paste" the entire number after it is read. It types it a character at a time.

While creating my forms I pay close attention to the tab order and which fields have tab stops. This way I control where the cursor is when a form is opened. In my case, I want it to open with the focus on the asset tag number. Then I put code in various events and use that number to look up and pre-fill other fields. I've actually got it set up to open a particular form based on the equipment type (thanks to various people on this forum!).

From what you see in previous posts, I did have to add an "Enter" keystroke to the configuration file on the motion tablets after the code. You may not need to do that but if you do, how to do it is in their knowledgebase. In some form controls, I was having trouble because it was only entering the first number of the barcode and then my code would execute (on change) with a partial number in that field and it would fail. Adding the enter keystroke and switching to "on update" solved the problem. Here are my notes on how to find it and what I had to do:

The full instuctions are posted in the Motion Computing Knowledgebase in article 10304. http://www.motioncomputing.com/kb/KnowledgebaseArticle10304.aspx?Keywords=add+a+prefix+or+suffix In short you need to use Wordpad to edit c:\Program Files\Intel\MCA\Bin\Intelhealthcare.cfg. Search for the word "postfix" and add {VK013} after the equals (=) sign. This causes the scanner to add an "Enter" keystroke after keying in the barcode. This will have to be done for every tablet that is going to be used on this project!

I've been meaning to post my database but it is over the size limit and was created in 2010 so I haven't gotten around to it yet. This forum by the way has been an essential part of getting this functioning as well as it does. I'm no expert so I need all the help I can get! Even if the responses don't solve the problem, they often get me on the right track so I can solve it myself.

Hope this helps,

Steve
 
Hi Steve
I usually come here when I am stuck or don't know quite where to start. I am in asset management as well. My project involves building a front end to our SQL data base that will use the barcode reader to identify the asset. The guys will then be able to select a variety of forms suitable for the type of asset they have scanned eg condition report, outage form, pump test info ect data can then be collected against that asset. Will save the paper getting lost and being manually re-entered. Thanks for the links and the thumbs up on several issues. I can see I will be back frequently.

Regard Sil
 

Users who are viewing this thread

Back
Top Bottom