access auto fill fields in a form depending on first digits of a scanned barcode

dale_j1992

Registered User.
Local time
Today, 06:56
Joined
Sep 23, 2016
Messages
26
hello, i am currently in the process of making a database where the end goal is to able to scan a barcode and store part measurement data against the barcode. i currently have a form where the first field is generated by scanning a barcode, the barcode consists of 12 digits the first 7 being the part number, i need to find a way of filtering depending on the first 7 digit only that then autofill another form with the required part information, i have around 15 different parts that it could be selected from. more info on barcode the barcode will be attached too the part and it will be that single crank or cranks personal identification number, the barcode is 12digits the first 7 digits is what i need too filter from because the last 5 digits are for the parts unique number for example the 56th camshaft woukd be 111111100056, the 1111111 of this number is what i need access too read and autofill some other fields in the table such as a text field saying camshaft. i hope this is more clear now. many thanks for your help. atm i have a database with a form, the first field is a number field. i have linked a usb barcode scanner so they scan the parts barcode first, its this field i need too use as mentioned above.
any help with this is greatly appreciated:)
 
You can use the Left() function to get the first 7 digits, and open a recordset on the appropriate table with that.
 
hello thanks for your reply :), im pretty new to access could give me some example on how too code the recordset? kind regards
 
Here's my template code:

Code:
  Dim strSQL  As String
  Dim db      As DAO.Database
  Dim rs      As DAO.Recordset

  Set db = CurrentDb()
  
  strSQL = "SELECT ..."
  Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)

  rs.Close
  set rs = nothing
  set db = nothing
 

Users who are viewing this thread

Back
Top Bottom