Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Bartvn is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    11

    MS Access 2010 - Barcode data capturing

    Hi,



    I'm currently developing an MS Access (2010) application and connected a barcode scanner to it for reading barcode information.
    Everything seems to work well for what concerns capturing the data into a field, but what I would like to do is to populate a complete form once the barcode has been captured and filled-in in the specific "barcode" field. The data that should be populated in the form comes from different tables.

    Does anyone know how to send an enter after the barcode data has been captured?
    Can someone provide me some basic code to do the trick, as I'm rather new to VB ?

    Objective is to read data from a barcode, which after an enter or update automatically populates the data in the form afterwards.
    The barcode data is already in the DB.

    Thank you all for your help and support !!
    Bartvn

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    All of my experience with barcode scanners and how they interact with Access is they behave just like any other Human Interface device. It should not be any different than typing directly into a field with a keyboard.

  3. #3
    Bartvn is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    11
    Dear ItsMe,

    Thanks for your reply. The objective is that when the barcode is scanned that the an enter is given directly, so that the customer data is directly filled-in in the form afterwards.

    I read this some where on the internet, but can't find it back.

    So I'm looking after a VB code on checking if the barcode Information is available in the DB and when this is the case, the data should be filled-in directly.

    Can someone help me with this?

    Thanks in advance,
    Bartvn

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I think user will have to press Enter key after the scan, just like after typing an input.

    Then code in BeforeUpdate event can verify if a record matching that code exists. Then how the related info is displayed on form is the issue. I think two options:

    1. query joining tables as the form RecordSource

    2. DLookup
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Every time I read post #1 I get more confused. First, the data is already in the DB. Then you state that you need to read barcodes using a scanner.

    If you want Access to print barcodes that a scanner can read you need to have the correct fonts loaded. I believe there are some popular fonts built in. If not built in, you can add them for not too much money.

    If you are trying to capture data from a scanner that is reading barcodes, no problem. Build a form, click in a TextBox field, and scan the barcode. The scanner will interpret the barcode and place the text into your textbox.

  6. #6
    Bartvn is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    11
    Dear ItsMe, June7,

    Thanks again for your reply.
    I'm looking more in the direction to what June7 indicaties, but looking after a tutorial or step-by-step approach.

    To give some more info:
    - in the DB i have a table where I store vehicule Information based on vehicule Unique number. For each Unique number i make a barcode, so that's why the data is available in the DB.
    - for each car maintenance we want to scan the barcode that we made per car (which is linked to a customer and a customer can have more than 1 car)
    - once the barcode is scanned, the Information about the car is displayed in the form below eg. Customer info, vehicule info, year build, etc.

    So i just would like to know how the data can be best filled-in once the barcode is scanned.
    i understood that a manual enter after the scan Will be necessary.

    thanks for your help!
    bartvn

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    A scanner may offer a canned msg if it does not read a barcode properly. ie ERROR 12.

    In the afterupdate event you can verify the input and then .Setfocus on the next field.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Just to clarify a point, all the scanners I've had experience with could be programmed to send a Tab or Enter after the input, and most did it "out of the box". As has been mentioned, I use the before and after update events of the textbox to handle the scan, and the user never has to hit Enter to initiate the process.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    When you scan the barcode and press enter, the "afterUpdate" event of the barcode text field will execute.

    In that event code, you will query the database for the values for that barcode, and populate the fields on the form.

    A significant design question is what you plan to do with the data on the form? Will it be used to create a new maintenance record, or merely displayed for the user?

    If merely displayed for the user, then I would suggest unbound text boxes on the form, and load them using VBA and a recordset.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    As pbaldy said, if the scanner can be configured to automatically send Tab or Enter, that is a big bonus. Sorry, I've never programmed for a scanner input.

    Guess I should have mentioned option 3. VBA code to fill data into controls. Probably shouldn't be saving the related info, that would be duplication of data, so presumably unbound controls on a form in Single view.

    Options 1 and 2 require little, if any VBA code. Option 3 could be a lot of code.

    You said the data is in 'different tables'. Why plural? How much related info? Do you want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Bartvn,

    I would like to add something after reading the thread again. You may know this, but just to clarify; you should not need to store a "Barcode" in your table. You store the text or number that the barcode represents.

    If you want to print a barcode (something a scanner can read), you format a textbox in a form with the appropriate barcode font. The leading and ending characters in a "Barcode" do not need to be stored in a field. Let the font dictate the "Barcode" format.

  12. #12
    Bartvn is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    11
    Hey Pbaldy,

    Do you have an example of the code of the before and after update event?
    I have the following table: "trucks" with the following fields:
    - truckID
    - truck_type
    - year_build
    - barcodeID

    I put the cursor in the barcodeID field when scanning the barcode. Once the numeric and text characters are field in in the text field, i would like first verify if the barcode exists and when it exists, an enter is doen afterwards.
    once the enter is done the sub-form fill-in automatically the customer Information that comes from another table named customers.

    Thanks for your help !!
    Bartvn

    PS: the barcode storend in the DB are numeric and text and not the barcode (image) itself.

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The code would vary widely depending on what you wanted to do, but here's an example of getting data from a table and filling in textboxes (snipped, closing code not included):

    Code:
      Dim strSQL             As String
      Dim db                 As DAO.Database
      Dim rs                 As DAO.Recordset
    
      Set db = CurrentDb()
      If Nz(Me.txtPartNum, vbNullString) <> vbNullString Then
        strSQL = "SELECT * FROM tblPartNumbers WHERE PartNumber = '" & Me.txtPartNum & "'"
        Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
    
        If Not rs.EOF Then
          Me.txtCost = rs!Cost
          Me.txtPartDesc = rs!PartDesc
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    Bartvn is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    11
    Dear all,

    I would like to know how i can do the following using a macro or VBA related to the scanning of a barcode:
    - scan de barcode => check if barcode exist
    - once the barcode exist, send an enter to populate the data in the sub-forms (2)
    - if the barcode doesn't exist, ask (throughout a Message) if the barcode should be adder to the DB or not.
    When the user selects yes, a specific form should pop-up so that the barcode can be linked to the correct customer.

    can someone help me with this with a step-by-step approach as this is rather new for me?

    Thanks in advance en best regards,
    Bartvn

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Options identified in posts 4, 10, 13.

    The real trick is figuring out what event to put code in. You need to first resolve the issue about the scanner sending enter or tab with the input. If that is possible, then use the textbox BeforeUpdate event with code like Paul shows.

    Another recent thread about scanning issues https://www.accessforums.net/access/...lem-38540.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. HELP! Barcode Fonts for ACCESS!
    By jlgray0127 in forum Programming
    Replies: 1
    Last Post: 03-13-2013, 02:14 PM
  2. Data Macro in Access 2010
    By rkalapura in forum Forms
    Replies: 4
    Last Post: 12-08-2012, 08:09 PM
  3. Import data from barcode
    By roughrider in forum Import/Export Data
    Replies: 2
    Last Post: 10-16-2012, 08:59 PM
  4. Replies: 1
    Last Post: 03-19-2012, 03:49 PM
  5. Access 2010 Data not saving
    By Stenya1177 in forum Access
    Replies: 1
    Last Post: 07-07-2011, 09:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums