Others

How to Import and Parse QR Scanner Data in Microsoft Access Forms

Bushra ParveenBushra Parveen Oct 21, 2026 871 views

Question details

The user needs to distribute a single scanned QR code string across multiple specific fields in a Microsoft Access form instead of having all data placed into one control.

How to Import and Parse QR Scanner Data in Microsoft Access Forms
Product
Microsoft Access
Device & OS
not provided
Scenario
Scanning a delimited QR code into a database form using a USB barcode or QR scanner.
Observed behavior
The scanner inputs the entire data string into the currently active control because it operates like a standard keyboard, failing to distribute the specific values into multiple corresponding fields.
Before you start

Ensure your QR codes are generated using a consistent delimiter (such as a comma or pipe) to separate the data values, and configure your scanner to automatically send an 'Enter' or 'Tab' keystroke after scanning.

Solution 1Recommended

Use VBA's Split Function to Parse the Scanned String

Capture the full scanned string in a dedicated input text box, then use a VBA macro triggered by the After Update event to divide the text and populate the rest of the form.

Since barcode and QR scanners act as keyboard emulators, they will dump the entire string into whatever field currently has focus. To fix this, you must parse the data programmatically into its component values and assign them to the correct fields.

1
Set Up the Input Control

Open your form in Design View. Create an unbound text box specifically for receiving the scanner input. Name it something recognizable, like 'txtScannerInput'.

2
Access the After Update Event

With 'txtScannerInput' selected, open the Property Sheet. Go to the Event tab, click the ellipsis (...) next to 'After Update', and choose Code Builder to open the VBA Editor.

3
Write the Split Function Code

Declare a string array variable. Use the Split function to divide the input string based on your delimiter. For example: Dim arrData() As String. Then write: arrData = Split(Me.txtScannerInput.Value, ",").

4
Assign Values to Form Controls

Map the resulting array elements to your actual form fields. For example, add: Me.FirstName = arrData(0) and Me.LastName = arrData(1). Add error handling to clear 'txtScannerInput' afterward for the next scan.

Use VBA's Split Function to Parse the Scanned String
Array Indexing Reminder: Remember that VBA arrays created by the Split function are zero-based. The first piece of data will always be at index 0.
Free Microsoft Office alternative

Manage Scanned Data Easily with WPS Spreadsheets

While Microsoft Access requires complex VBA coding to parse scanned inputs, WPS Spreadsheets offers a highly compatible, free, and lightweight alternative for organizing scanned data. Enjoy powerful built-in data parsing tools without writing a single line of code.

  1. 1. Scan Your Data: Open a new workbook in WPS Spreadsheets and scan all your QR codes into a single column.
  2. 2. Use Text to Columns: Select the column containing your scanned data, navigate to the Data tab, and click on 'Text to Columns'.
  3. 3. Distribute the Data: Select 'Delimited', choose the specific delimiter used in your QR codes (like a comma), and click Finish to automatically separate the values into adjacent columns.
Free and lightweight Microsoft Office alternative with no subscription feesHigh compatibility with Microsoft Excel (.xlsx and .csv) formatsIntuitive Text-to-Columns feature for instant parsing of delimited scanner dataFamiliar interface ensuring a seamless migration process
microsoft office alternative - wps office

Frequently Asked Questions

Why does my scanner put all data into one field?

USB scanners typically emulate standard keyboard input. They type out the scanned string rapidly into whichever field is currently active until a termination keystroke (like 'Enter') is sent, meaning they cannot jump between fields automatically without a programmed delimiter.

Can I use a different delimiter besides a comma for my QR codes?

Yes, you can use semicolons, pipes (|), or tabs when generating your QR codes. You simply need to ensure that the delimiter specified in your VBA Split function matches the one used in the QR code.

How can I handle errors if a scanned QR code has missing data?

Before assigning array elements to form fields in your VBA code, use the UBound() function to check the size of the array. For example, if UBound(arrData) < 2, you can trigger a MsgBox to warn the user that the scanned code is incomplete.