How to Preserve Spaces in Scanned Barcode Values in Microsoft Access
Question details
The user needs to understand why spaces are stripped from scanned barcode inputs in Microsoft Access and how to ensure the spaces are retained in the database records.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Scanning barcodes (such as those generated by a Zebra printer) into a Microsoft Access database table or form.
- Observed behavior
- Spaces present in the physical barcode disappear or are not recorded when the scanned value is stored in the database field.
Verify that your hardware is correctly transmitting spaces by scanning the barcode directly into a plain text editor like Notepad before modifying your database.
Verify and Reconfigure Barcode Scanner Hardware
Hardware settings often dictate whether special characters, including spaces, are transmitted to the computer.
Microsoft Access stores barcode data exactly as it is sent by the scanner interface. If spaces are missing, the scanner itself may be configured to strip them to speed up data entry or conform to a specific keyboard emulation mode.
Open a plain text editor like Notepad on your computer and scan the barcode. If the spaces are missing here as well, the issue is with the scanner, not Microsoft Access.
Locate the user manual for your specific barcode scanner model to find the configuration barcodes related to character transmission.
Scan the appropriate configuration barcodes provided in the manual to ensure the scanner includes space characters and does not trim them during keyboard emulation.
Check Access Table Field Data Type and Format
Ensure the database table is configured to accept text strings containing spaces.
Inspect Form Control Properties and VBA Macros
Data entry forms can contain properties or background code that modify inputted values before saving them to the table.
Manage Barcode Data Easily with WPS Office
If you need a simpler way to track and log barcode data without dealing with complex database configurations, WPS Spreadsheet provides a lightweight, free, and highly compatible alternative. You can easily log barcode scans with spaces intact.
- 1. Open WPS Spreadsheet: Launch WPS Office and create a new blank spreadsheet.
- 2. Select the target cell: Click on the cell where you want the scanned barcode data to appear.
- 3. Scan the barcode: Use your connected barcode scanner. WPS Spreadsheet will instantly record the exact string, including all spaces.

Frequently Asked Questions
Why do barcodes generated by my Zebra printer lack spaces when scanned?
The issue often lies in the barcode symbology used during generation. Some formats (like standard Code 39) require special settings to encode spaces, while others (like Code 128) support spaces natively. Check your label generation software settings.
Does Microsoft Access automatically remove spaces from typed or scanned inputs?
By default, Microsoft Access does not remove spaces between words in a Short Text field. However, trailing spaces may be ignored, or specific Input Masks and VBA macros added by the database creator might automatically trim spaces.
How can I test if my barcode scanner is sending space characters?
Plug your scanner into your computer, open a plain text application like Notepad, and scan the barcode. If the spaces appear correctly in Notepad, your scanner is configured properly, and the issue is likely within your database software.




