| | |
Problem on using keyboard wedge Barcode scanner with VBA
![]() |
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Solved Threads: 0
Hello,
I was offer a project to record Loan of equipment using a keyboard wedge Barcode scanner to scan ID barcode from the Equipment, But i had a hard time control the textBox of the Form for the barcode input, the Input keep jumping away from the textbox that set focus to. Some times the Form fail to detect the code Textbox_change.
Is there any ways that i could catch the input of the scanner or control it?
I was offer a project to record Loan of equipment using a keyboard wedge Barcode scanner to scan ID barcode from the Equipment, But i had a hard time control the textBox of the Form for the barcode input, the Input keep jumping away from the textbox that set focus to. Some times the Form fail to detect the code Textbox_change.
Is there any ways that i could catch the input of the scanner or control it?
•
•
•
•
v
The barcode scanner acts like a keyboard so use the KeyPress Event in the form.
Usually, these scanners have a few characters at the start that identify it as a barcode scan.
You can evaluate the ASCII value in the keyPress event to determine if the keyboard input is actually a BarCode scan. If so, you might want to hide a control on your form like a list box to capture the data.
But here's the PseudoLogic
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
If Ascii Value = BarCode then list1.setfocus ' remaining characters should then go into the listbox control. ' extract the list contents and do whatever you want with it. else End if
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Solved Threads: 0
Hey hkdani,
Thanks for reply to me, it really helps me, but i still have a big problem. When a string catch into a ComboBox by a barcode Scan, i use the ListIndex check to cause a auto Jump (frmLoan.show vbModal) to another Form. But After that on the other form the (textbox_change) or (combobox_AfterUpdate) will not work, no matter what i scan with the barcode or Key in, the string do apperd on the combobox, but it will not Auto Match the String and no code will run. What is happening? It dose not look like it was Halt.
Thank you for the Reply again!
Thanks for reply to me, it really helps me, but i still have a big problem. When a string catch into a ComboBox by a barcode Scan, i use the ListIndex check to cause a auto Jump (frmLoan.show vbModal) to another Form. But After that on the other form the (textbox_change) or (combobox_AfterUpdate) will not work, no matter what i scan with the barcode or Key in, the string do apperd on the combobox, but it will not Auto Match the String and no code will run. What is happening? It dose not look like it was Halt.
Thank you for the Reply again!
Just include a barcode scan for an example. Throw it into Notepad or something. It should be all text characters. I can better tell you what you should do after seeing a scan.
And are you using Visual Basic for Applications (VBA) or are you using a regular Visual basic Form?
But really I would go through with my first recommendation of hiding a list box on the form and forcing the input to go there so you can deal with it there. The user wouldn't see the information, but you can process the information and deal with from there: e. g. save it in a database, set it in a label or textbox, etc.
Basically, you are dealing with an Event that Visual Basic does not deal with. So, you should declare your own Events in a class module to deal with the situation.
ClsModuleScanner
And are you using Visual Basic for Applications (VBA) or are you using a regular Visual basic Form?
But really I would go through with my first recommendation of hiding a list box on the form and forcing the input to go there so you can deal with it there. The user wouldn't see the information, but you can process the information and deal with from there: e. g. save it in a database, set it in a label or textbox, etc.
Basically, you are dealing with an Event that Visual Basic does not deal with. So, you should declare your own Events in a class module to deal with the situation.
ClsModuleScanner
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Public Event BarCodeScanned Public Function ProcessBarCode(ByVal Scan as string) as string RaiseEvent BarCodeScanned End function
Last edited by hkdani; Dec 19th, 2007 at 2:23 pm.
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Solved Threads: 0
Hi,
Thanks Alot, the Idea of placeing the Input to a textbox i aready use it in the first Place, but today after i remove it then i found out that was the step that cause the next form to be able to detect the changes that i key. So i use now only the ComboBox_keydown to detect the keycode 13 (which the Barcode scanner sent), set it to 0 and run a sub to check the string input. Now i able to control the setfocus, About the ClsModuleScanner I'm sorry, i not very sure how to use it (never use function or event before).
Thank you for the Help, my problem has been solve. I have no idea how the textbox cause the next form to malfunction?
Thanks Alot, the Idea of placeing the Input to a textbox i aready use it in the first Place, but today after i remove it then i found out that was the step that cause the next form to be able to detect the changes that i key. So i use now only the ComboBox_keydown to detect the keycode 13 (which the Barcode scanner sent), set it to 0 and run a sub to check the string input. Now i able to control the setfocus, About the ClsModuleScanner I'm sorry, i not very sure how to use it (never use function or event before).
Thank you for the Help, my problem has been solve. I have no idea how the textbox cause the next form to malfunction?
Last edited by wargamer2004; Dec 21st, 2007 at 9:02 am.
•
•
•
•
Thanks Alot, the Idea of placeing the Input to a textbox
If you don't have your MSDN Library CD's, you should get a copy. They have some excellent documentation on how to work with class modules and create your own events.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: flash window
- Next Thread: DataReport in vb6
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





