Results 1 to 37 of 37

Thread: Reading a Barcode

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651

    Reading a Barcode

    I have a barcode scanner - model LXE.

    I need to scan a printed barcode & then display whats on this barcode in an access database.

    How do i use VB to store the information i scan into my database?

    Any advice would be great.
    Gilly

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Does the scanner have an interface? i.e. a comm port on it ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    not sure?? How do i tell. It has a screen which displays the barcode after you scan...However, currently when i scan the barcode it displays the wrong number?..(thats beside the point...i just need to be able to transfer the barcode info into a database...
    Gilly

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Okay are there any little ports on the barcode scanner that look similar to your monitor connection ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    No, nothing. I cannot attach the scanner to a computer as i need to have flexiblilty in moving the scanner around a massive warehouse. I've been told that i need to scan / telnet to an IP address...so my vb program will sit on a computer & my scanner will hit that computer using a spefic Ip address and port...

    I then need to store the scanned barcode into a table in my databse.

    The barcode is already printed and waiting to be scanned, i just dont know how to communicate to my computer & store the scanned info in a database....

    Sounds very complicated...! Where do i start?!
    thank you.
    Gilly

  6. #6
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    So how are you proposing in getting the information from the scanner onto some sort of computer system?
    If the scanner interfaces with a computer, you could use a laptop computer, and have a wireless network installed inside the warehouse...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    We have access points / anteni set up on the roof of our warehouse! .......a radio network is already in place. My scanner is expected to bounce of this and be directed to an IP address (a computer on our network) and this is where the vb program will reside....
    Gilly

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Winsock should work - using IP addresses to communicate....should i go down this line?..
    Gilly

  9. #9
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    assuming it's being sent to your ip then you could use sockets so you could investigate winsock, your server computer would have to listen all the time

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Ok, i'll investigate how to use winsock.

    Thanks for all your advice.
    Gilly

  11. #11
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Hangon there's still something missing here.
    If there's a wireless network in place, then there's no problem using winsock or anything like that for networking.

    But what I want to know, is how is the scanner supposed to communicate with the network ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    TCP.... i assume. I specify an IP address & a port to connect to....that should work?
    Gilly

  13. #13
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    That much I get.
    But...

    Okay. You're holding a barcode scanner in your hands.
    Does it have access to the network? Is it running windows?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Yes, my barcode will have access to the network.
    No, it's not running windows.

    Maybe its not possible? All very new to me...

    I thought that i could scan the barcode - then the radio equipment we have installed would pick up the signal & transmit the barcode info via TCP to my specified IP address....

    Will that work?
    Gilly

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    I've got a program which i used a couple of years back when i was initially going to do this..this project got put to the side & i never got around to doing it..

    I think this program will maybe work...but i cant make sense of what this code is trying to do? or how it works. When i run it, nothing happens...i get no errors - it simply runs!

    See attached..winsock sql example.
    Attached Files Attached Files
    Gilly

  16. #16
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Originally posted by gilly
    Yes, my barcode will have access to the network.
    But you need something that can run a VB application that can somehow be given that barcode - i.e. the scanner can run a VB application, or, the scanner can interface with a computer...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Yes, i want my scanner to interface with a computer on my network. The computer will wait & listen for any connections - then once a scan is made - it will store it in my database.

    My computer will run the vb application.

    Any ideas how to get me off the ground?
    Gilly

  18. #18
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    The difficult issue is plugging the scanner into the computer - or somehow getting scanner information into your vb application.
    What's it supposed to interface with?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  19. #19
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Doesn't it come with some documentation? What's the brand and model?

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    LXE

    xcvr model # 480824-3300

    It's an old scanner - lost all documentation...

    Are all barcode the same format? Do different barcode scanners read different barcode fonts?
    Gilly

  21. #21
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Are you certain it has wireless feature? You mentioned telnet awhile ago... if so then I'm guessing it stores scan info in its internal memory. Then later on, you connect it via LAN card and a rollover cable and do a telnet session (just like configuring a router, switch) to download the stored data.

  22. #22

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    We have access points attached to the roof of the warehouse. These act as a router - they contain the IP info of the computer where i sent my scanned info to...

    My software will sit on a computer on my network listening for an connections.

    This is the idea...but i need help to get started coding?
    Gilly

  23. #23
    Registered User
    Join Date
    Mar 2004
    Location
    in a dirthole
    Posts
    117
    okay this is what's going on after i read that entire thread what i get is that the baricode is connected to a router through wireless connection then it will send the data via IP to the correct IP and port of the computer which will be running the VB application then then application will save it all to database, correct?

  24. #24
    Registered User
    Join Date
    Mar 2004
    Location
    in a dirthole
    Posts
    117
    and i dont think if it's sending info over the network then the computer wont actually need any drivers or info on the scanner the program would just grab the info it is sending to the router so all you really need to do is use winsock to grab the information from that IP and port of which the scanner is hooked up to and then put all the data into the VB application and save it to a Database via SQL

  25. #25

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    EXACTLY!. Do you know how i do this in winsock? Can you give me a kick start? I've been told that i should use telnet to sit & listen for a connection..
    Gilly

  26. #26
    Registered User
    Join Date
    Mar 2004
    Location
    in a dirthole
    Posts
    117
    ok i was going through on how to do it and it's gonna be hard but yes winsock can do the trick but you really need to know what the IP is and Port the wireless barcode is connected to on the router and you'll have to forward anything coming from the barcode port to the port that the computer is on, get what i mean? so if you dont know what port the wireless connecter is set up to work on then your gonna have to get a portscanner and scan that IP to find the open port, whould only be one but may be more, we can talk more about it through email [email protected] or AIM(Aol Instant Messanger) krptodr
    Last edited by krpto; Mar 9th, 2004 at 01:14 PM.

  27. #27
    Lively Member
    Join Date
    Aug 2003
    Location
    Philadelphia, Pa.
    Posts
    123
    If your scanner is running PocketPC, I could really help you out.

    You have to tell us what OS it is running.

  28. #28
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    He said it's old, so it's highly unlikely

  29. #29
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    hi gilly, hows you?


    About this problem, i guess the scanner needs to be physically connected to a computer for it to actually scan, is it? or not?

    then from this client computer you can send the data to your server using winsock or any other way.

    But the main question, is the scanner connected to any computer or not?

  30. #30

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    No, its not connected to any computer - its a handheld scanner.

    Im going to try & write a vb program that will sit and listen for a connection on a specific port.

    Will winsock allow me to do this?
    Gilly

  31. #31
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    above somewhere you have mentioned that u have a wireless network with access points. but What I do not understand is, if your handheld scanner is old, like you say, how would the handheld transmit the data, what it scanned.

  32. #32

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    I'm assuming the access points will act like a router.....My scanner will have a programmed IP address & port set up within it....... When i scan a barcode it will find the computer with my vb program which will be sitting waiting/listening for a connection.

    I then need to add barcode info to a database....whatever i scan i need to add to the database..

    This is how i see it....

    I've started my program - i have winsock set up, listening on port 1100 listening for a connection. It works. However I also need to be able to add the barcode number that i scan to my access database... this code below works , but doesnt add to a database....any ideas how to code this?
    Cheers

    VB Code:
    1. Option Explicit
    2.  
    3. Private nextSocket As Long
    4. Private strReceived() As String
    5.  
    6. Private Sub Form_Load()
    7.     With sock(0)
    8.         .LocalPort = 1100
    9.         .Listen
    10.     End With
    11.     nextSocket = 1
    12.     Text1.Text = "sock(0) : Listening on port 1100"
    13.     ReDim strReceived(0)
    14. End Sub
    15.  
    16. Private Sub Form_Unload(Cancel As Integer)
    17.     Dim i As Long
    18.     For i = 0 To sock.Count
    19.         If sock(i).State <> sckClosed Then
    20.             sock(i).Close
    21.             DoEvents
    22.         End If
    23.         Unload sock(i)
    24.     Next
    25. End Sub
    26.  
    27. Private Sub sock_Close(Index As Integer)
    28.     Debug.Print "Connection closed on sock(" & Index & ")"
    29.     Unload sock(Index)
    30. End Sub
    31.  
    32. Private Sub sock_Connect(Index As Integer)
    33.     Debug.Print "Connected on sock(" & Index & ")"
    34. End Sub
    35.  
    36. Private Sub sock_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    37.     Dim i As Long
    38.     Load sock(nextSocket)
    39.     ReDim Preserve strReceived(nextSocket)
    40.     With sock(nextSocket)
    41.         .Close
    42.         .Accept requestID
    43.         Text1.Text = Text1.Text & vbCrLf & "sock(" & nextSocket & ") : Accepted connection"
    44.     End With
    45.     nextSocket = nextSocket + 1
    46. End Sub
    47.  
    48. Private Sub sock_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    49.     Dim strData As String
    50.     sock(Index).GetData strData, vbString
    51.     If InStr(strData, vbCrLf) = 0 Then
    52.         strReceived(Index) = strReceived(Index) & strData
    53.     Else
    54.         Text1.Text = Text1.Text & vbCrLf & "sock(" & Index & ") : " & strReceived(Index)
    55.         strReceived(Index) = ""
    56.     End If
    57. End Sub
    Gilly

  33. #33
    Registered User
    Join Date
    Mar 2004
    Location
    in a dirthole
    Posts
    117
    ok listen the barcode scanner is wireless so stop asking if it connectes to the computer, now Gilly if you say that the code is grabbing the scanned barcode from the port 1100 then it's gotta be working so yes that code is working but for it saving to the database you could make your own database and read and write it that way it's just mean alot of coding if you need help just ask me later

  34. #34

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Thanks krpto!! Yes everyone - I'm making a wireless connection & i've tested it & it's works great!! My scanner doesnt need to be physically attached to my computer - it sends data via a wireless network.

    Now that i have the communication established, i need to insert each barcode which i scan into a database.

    How can i do this?

    EG. if the barcode text reads something like this 123ABC78dd8888888777777

    The first 2 digits represent a field in my table
    The next 6 represent another field...etc etc...

    I need to break up the string & insert it as indivdual fields into my table.

    thanks for any help in advance.
    Gilly

  35. #35
    Registered User
    Join Date
    Mar 2004
    Location
    in a dirthole
    Posts
    117
    well what you have to do is if you code in vb6 then to divide the first two digits is use the Left("string", how many numbers to get) which let's say if you wanan get the 12 of 12345678 you'd use
    VB Code:
    1. strString= "12345678"
    2. label2.caption= left(strString, 2) ' the 2 is how many numbers to grab from the string
    then have it do if then statements for where to put it if it falls under a certain category like if the 1 was sporting goods and then save it to that part of the database, im not familiar with barcodes so i can't tell ya what the different sections are, then if you wanna find the next 6 out you would use the Mid funtion
    the mid fuction would be used like this,
    VB Code:
    1. strString= "12345678"
    2. label1.caption= Mid(strString, 3, 6) ' the 3 is the starting number to grab and the 6 is where to end
    now my memory is alittle vague on the mid function but what i think i haev set up is to start at the 3 and get the next 6 from the barcode, so if you need any other sections just use the mid function but for the first two deffinatlly use the left string function, that should work on how to split up the barcode into different sections

  36. #36

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Location
    N.Ireland
    Posts
    651
    Thanks K
    I've actually re-thought my project overnight & i feel it would be best if i could output the barcode information to a csv or text file.

    i.e. when i scan each barcode i want to create a new text or csv file. i.e. store these text/csv files in a directory on my computer. C:\BarcodeFiles\. So each barcode which i scan will create a new file.

    How do i do this? IS it possible....anyone?!
    Gilly

  37. #37
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Use a dynamic array, each time you scan add a new array element to hold the info. Latre when your gonna create the text file, loop through the dynamic array.

    For naming convention of the text file, to ensure it is unique, add the date mmddyy and time HhNnSs (military time) info to the filename

    Barcodes - [Date] - [Time].txt

    IMPO, yyyymmdd would be a better format so they will sort properly in the explorer window

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width