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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting a Bar Code Reader to VB application 2

Status
Not open for further replies.

arna

Programmer
Sep 14, 2001
5
0
0
IN
I am suppose to develope a application for a book shop . I have make use of Bar Code reader so can any one tell how to connect a bar code reader in my application WHICH DEVELOPED in Visual Basic 6.0 . Please treat this as most urgent
 
'Maybe this will get you started

Private Sub mscomm2_OnComm()
Dim sBarScan as string
If iFlag = 1 Then Exit Sub
If flag = 1 Then 'Text boxes empty?
For i = 0 To 2
txt(i) = ""
Next i
flag = 0
End If
sBarScan = left(MSComm1.Input, 12)
rs.Open ("SELECT * from ItemInfo where Identifier = '" & sBarScan & "'") 'ItemInfo is table in my db
iDeptNum = rs(3) 'Get Dept# for scanned item
DeptAmt = rs(2) 'Get amt for scanned item
SubAmt = SubAmt + rs(2) 'This is subtotal
txt(0) = txt(0) & rs(1) & vbCrLf 'Add itemDescript to display
txt(1) = txt(1) & FormatNumber(DeptAmt, 2) & vbCrLf 'Add amount of item to display
rs.Close
ScratchPad 'go add the scanned amount into the department
 
arna, as far as I'm concern, barcode scanner acts just like a keyboard. It reads barcode, send it to PC and display it on a human readable character (text). So I guess you don't have to worry about how to "read" input from a barcode scanner.

you can do a simple test if you're not sure. Go to MS-DOS prompt, scan a barcode and see what displayed on screen. It should be a common text like we know.
 
Hey Arna, I have developed a number of apps using barcode scanners, mostly the type plugged into the keyboard port. They send data through as if it were being typed. Depending upon which scanner you are using, and the barcode types (I know ISBN numbers often have additional 2-of-5 codes tagged on to show the price etc) I have loads of short subs for barcode checksum validation etc, if anyone wants it I can send them through.

 
Hi, jimmo

I am interested in the codes for barcode reader.

Thanks alot

yputopia.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top