Fix Access CSV Import Errors: Incorrect Dates and Malformed Data
Question details
The user needs to resolve an issue where importing CSV files into a database fails or produces malformed data and incorrect dates.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Importing externally sourced CSV files into database tables using VBA routines or import features.
- Observed behavior
- Certain CSV files import successfully, while others return malformed values (such as "ent.,,,,,,") for dates or fail completely when writing to the target table due to parsing errors.
Before modifying your import scripts, open the failing CSV file in a plain text editor to manually verify the delimiters, text qualifiers, and date formats against a working file.
Use Access Import Specifications Instead of Hardcoded VBA
Leverage built-in import specifications to handle complex CSV formatting, such as quoted commas and dynamic field lengths, more reliably than basic string parsing.
Writing custom VBA to parse CSV lines often fails when data contains text qualifiers (like quotes) or inconsistent column lengths. Access Import Specifications natively understand text qualifiers and will prevent shifted columns.
Go to the 'External Data' tab on the Access ribbon and select 'New Data Source' > 'From File' > 'Text File'.
Browse to your problematic CSV file, choose to import the source data into a new table, and click 'OK'.
In the wizard, click the 'Advanced...' button. Ensure 'Delimited' is selected, define the comma as your delimiter, and strictly set the 'Text Qualifier' to a double quotation mark (").
Verify the date formats in the advanced settings, save the specification, and use this saved specification name in your VBA `DoCmd.TransferText` method.

Debug and Refactor VBA Parsing Logic
If you must use custom VBA, update your script to dynamically validate array bounds and securely parse dates.
Pre-Process and Clean CSV Data
Standardize the external CSV files using a spreadsheet tool to ensure consistent formatting before passing them to the database.
Easily Manage and Clean CSV Data with WPS Office
If you frequently struggle with messy CSV files causing database import errors, WPS Office provides a free, lightweight, and highly compatible alternative for data preparation. Use WPS Spreadsheet to seamlessly open, clean, and format your CSV data before importing it into any database system.
- 1. Download and Install: Download WPS Office from the official website and complete the quick installation process.
- 2. Open Your CSV: Launch WPS Spreadsheet and drag-and-drop your problematic CSV file directly into the workspace.
- 3. Format and Save: Use intuitive formatting tools to align date columns and remove delimiters, then save a clean version ready for database import.

Frequently Asked Questions
Why does my database import CSV dates incorrectly?
Dates often import incorrectly if the source CSV uses varying date formats, or if your import routine relies on fixed character positions (e.g., extracting exactly 10 characters at the end of a line). Using standard date casting functions like `DateValue()` helps resolve this.
How do quoted commas break my CSV import?
If a CSV field contains a comma inside quotation marks (like "Smith, John"), a basic split function will treat that comma as a column separator. This shifts all subsequent data fields into the wrong columns, causing data type mismatches.
What is the best way to handle dynamic CSV files in VBA?
The most robust approach is to use built-in Import Specifications that natively handle text qualifiers, or to implement a dedicated CSV parser class in VBA rather than relying on basic string manipulation functions.




