How to Fix Undefined Function Left Error in Access Query
Question details
The user needs to resolve an issue where an SQL query fails to execute due to an undefined function error.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Running an SQL query via a form button, particularly in a database that was converted from an older MDB file format.
- Observed behavior
- Microsoft Access triggers an "Undefined Function 'Left' in Expression" error during query execution, even though the same database file functions correctly on a different computer.
Before modifying VBA references or restructuring your file, ensure you have created a backup copy of your current Access database to prevent accidental data loss during troubleshooting.
Check and Repair Missing VBA References
This is the most common fix. Missing or broken VBA references can cause built-in string functions like Left() to fail and return an undefined function error.
When an Access database is moved between computers with different software configurations, library references may break. Fixing these references restores the functionality of built-in SQL and VBA functions.
In Microsoft Access, go to the 'Database Tools' tab on the ribbon and click on 'Visual Basic', or simply press Alt + F11 to open the editor.
In the Visual Basic for Applications window, click on 'Tools' in the top menu bar, and then select 'References'.
Scroll through the list of checked available references. Look for any item that begins with 'MISSING:'.
If you find a missing reference, uncheck the box next to it if it is not needed, or click 'Browse' to locate the correct file path for the missing library. Click 'OK' to save.
Click 'Debug' in the top menu and select 'Compile [Your Database Name]' to ensure there are no remaining reference errors.

Import Objects into a New Blank Database
Use this solution if repairing references does not work. This resolves hidden file corruption that often occurs when older MDB files are converted to newer formats.
Try WPS Office for Your Everyday Productivity Needs
While Microsoft Access is a specialized tool for complex database management, WPS Office is an excellent, free alternative for your daily document processing, spreadsheets, and presentation tasks. Enjoy a lightweight suite that is highly compatible with Microsoft Office formats.

Frequently Asked Questions
Why does the undefined function Left error only happen on one computer?
This occurs because the problematic computer has different software configurations, different Microsoft Office versions, or missing system library files (.dll or .ocx) that break the VBA references required by your Access database.
Are other functions affected when the Left() function is undefined?
Yes. When VBA references are broken, it typically disables an entire library of built-in string and date functions. You will likely experience similar undefined errors if you try to use Mid(), Right(), Trim(), Date(), or Chr() in your SQL queries.
Does converting an old MDB file to ACCDB cause these function errors?
It can. Converting older .mdb databases to the newer .accdb format can sometimes leave behind outdated reference pointers or introduce minor structural corruption, which prevents basic functions from evaluating correctly. Importing your objects into a fresh .accdb file usually resolves this.




