Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Barcode scanning into Excel

Status
Not open for further replies.

DamnTheMachine

Technical User
Dec 29, 2004
3
CZ
Hi, I have made "dummy" VB program for me to scan into Excel database. I needed to scan 5 barcodes from each box we're receiving into the warehouse. Then I'm making CSV file out of them in Excel - and I think I could do this in VB as well, if knew the code for this...(I needed to take "-" out of each P/N).
I have predefined lenght of each barcode and in VB I use autotab after scanning each barcode. What I need instead of manualy pressing "ADD" button is that VB stores scanned barcodes and clears everything and goes back to textbox1.Also I need error notification if wrong barcode scanned (P/N instead of Qty, etc..)
Any ideas?Cheers, Sean, Czech rep.
 
In each text box add code to check for data with the correct
length. If data exists, call a routine which checks all
5 text fields for data with the correct the correct
length.
Do the barcode fields have a prefix (ie AIGA)?

EXAMPLE of 3 text boxes with a length of 12,
the form will display a "done" message box when the 3 fields have been filled:
'
Option Explicit
Dim ilen As Integer

Private Sub Form_Load()
Text1 = ""
Text2 = ""
Text3 = ""
End Sub

'Text1
Private Sub Text1_Change()
ilen = Len(Text1)
If ilen >= 13 Then Call comma_out '13 to allow for "-"
End Sub

'Text2
Private Sub Text2_Change()
ilen = Len(Text2)
If ilen >= 12 Then Call comma_out
End Sub

'Text3
Private Sub Text3_Change()
ilen = Len(Text3)
If ilen >= 12 Then Call comma_out
End Sub
'-----------------------------
'remove the "-" from text1 and check all for correct
'length. if ok display "done"
Private Sub comma_out()
Text1 = Replace(Text1, "-", "")
ilen = Len(Text1)
If ilen < 12 Then
Text1 = ""
Text1.SetFocus
Exit Sub
End If
ilen = Len(Text2)
If ilen < 12 Then
Text2 = ""
Text2.SetFocus
Exit Sub
End If
ilen = Len(Text3)
If ilen < 12 Then
Text3 = ""
Text3.SetFocus
Exit Sub
End If
MsgBox ("done"), , _
"done"
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top