Jump to content





Recent Status Updates

  • Photo
      16 Apr
    Kadence

    If you're reading this, you're on my profile and I know you're on my profile because I'm probably viewing yours.

    Show comments (6)
  • Photo
      10 Apr
    Poe

    Finally (and hopefully) i'm getting a team together that knows a little of this and a little of that; and maybe all my open source projects that are half written can begin to be released. :)

View All Updates
Photo
- - - - -

How to get barcode reader to search Access Database


  • Please log in to reply
8 replies to this topic

#1 JamesN

JamesN

    CC Lurker

  • Just Joined
  • Pip
  • 4 posts

Posted 31 January 2008 - 10:17 AM

Hi,

Sorry if this is the wrong place..

I'm a beginner at vb.net and Access.
I'm using a barcode reader to scan in items, and then I want to search an access database and display the saved details on this item in the application.
I'm wondering if anyone can put me in the right direction,

What interface do I need the reader to be in: keyboard wedge/RS232?
Do I need a API to act in between the two: Reader and vb.net

Any help or advice would be great.
  • 0

#2 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 31 January 2008 - 12:50 PM

All of the readers I have used simply scan and print the text wherever the cursor is. Your reader may be different but open notepad and scan something. Does the scanned text appear?
  • 0

#3 Xantara

Xantara

    CC Newcomer

  • Just Joined
  • PipPip
  • 16 posts

Posted 31 January 2008 - 01:04 PM

i'm confused...your title states "search access"....so..

What exactly are you trying to do? Are you scanning something with a barcode and then putting it in an access database and you want to know how to go from the scan to the database?

If this is the case, i may be able to help you
  • 0

#4 JamesN

JamesN

    CC Lurker

  • Just Joined
  • Pip
  • 4 posts

Posted 31 January 2008 - 01:59 PM

Hi,

My scanner is working, it will scan the codes into notepad.

I'm going to have the barcode numbers saved in access, so once i scan the items, vb will search for it in the database and display the details on the form.
I hope this clears up what I'm trying to do..
Thanks,
James
  • 0

#5 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 31 January 2008 - 06:19 PM

Yes, that is clear. You don't need an API but you will need to code a timer and onChange event for your text box (or whatever the barcode will scan into). I suggest a timer because that is how I've done it in the past, there may be better methods. When the textbox changes (text is entered) start the timer. In three seconds execute your search function (I suggest three seconds because any sooner in my tests caused an incomplete fill from the scanner). What code do you have so far?
  • 0

#6 JamesN

JamesN

    CC Lurker

  • Just Joined
  • Pip
  • 4 posts

Posted 01 February 2008 - 01:29 PM

Hi,

At the moment I'm having trouble even getting data to come back from databaase.
I'm going to set the timer 2moro, and I'll let you know how it goes, I tried it with out timer, and like you said it didnt take in all of the barcode, only first number.


This is the code I have at the moment:
 Private Sub txtBarcode_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBarcode.TextChanged

        'This searches the database for the required search fields
        objScanDA.SelectCommand = New OleDb.OleDbCommand( _
        "SELECT * FROM Product WHERE Barcode = '" + txtBarcode.Text + "' ", objConnection)

        'Fill the DataSet
        objScanDA.Fill(objDataSet, "Scan")

        'Bind the text boxes
        TextBox1.DataBindings.Add("Text", objDataSet, _
                "Scan.Size")

        TextBox2.DataBindings.Add("Text", objDataSet, _
                "Scan.Price")



    End Sub

It runs, but nothing happens. I need to set the timer, and hopefully that will make a difference.

Thanks.
James
  • 0

#7 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 01 February 2008 - 05:03 PM

I created a barcode scanner for an LXE device running Windows Mobile 5.0 and this was the best (quickest) method I could come up with (using a timer). It works great still. Basically, just take everything you have in your textChanged function now and replace it with timer.start. Once your timer reaches 3 seconds execute what you have now.

If you need help let me know. I have C# code that does a similar procedure except it uses a network file created from Oracle instead of an Access DB.
  • 0

#8 JamesN

JamesN

    CC Lurker

  • Just Joined
  • Pip
  • 4 posts

Posted 02 February 2008 - 05:10 AM

Hi,
Thanks a million I got it working with the timer, But only problem is how would you go about scanning a number of items.
Can I call the timer function from a button?

Private Sub ScanNextItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ScanNextItem.Click
Call Timer2_Tick()
End Sub

This is not working?

I would be very grateful if you could send me on that c# code..

Thanks,
James
  • 0

#9 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 02 February 2008 - 07:33 AM

You should be enabling Timer2 instead of calling the Tick function. Once the timer count-down is complete it will execute the tick function. Can you post more of your code? Or attach the source here?b

It will be Monday before I can send the C# code. It is at work, also keep in mind it is for Windows Mobile 5.0 so it may look a little different. What version of Visual Basic are you using (2003/2005/2008)?
  • 0