Access VBA Error - Undefined Function 'Left' in Expression

Hello,

My Access database has recently had trouble any time I run code, a query or report that calls one of the standard functions (Left(), Right(), Date(), etc.).  I get an error "Undefined Function 'Left'  in Expression"

When I compile my code, I get no compile-time errors.

I know this is frequently associated with broken references, however I have no missing references (see the attached image).

Any thoughts?

Thanks.
References.png
ChrisIT ManagerAsked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
OK ... so it's A2007.  Still, it needs to be in a Trusted Location.  Has the db been moved?

If not, try running the procedure below (ignore the Reference part):


Open the VBA Editor and from the menu ...Tools>>References ....
If you see any listed as **Missing: <reference name>, including the asterisks and the word Missing, the
you need to fix that first.

Then, follow this procedure:

****
0) **Backup your MDB BEFORE running this procedure**
****
1) Compact and Repair the MDB, as follows:
Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
Close the mdb after the Compact & Repair.
2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
3) Close the mdb
4) Open the mdb and do a Compact and Repair (#1 above).
5) Close the mdb.
6) Open the mdb:
    a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
    b) From the VBA Editor Menu at the top of the window:
       >>Debug>>Compile
        Note ... after the word Compile ...you will see the name of your 'Project' - just an fyi.

7) Close the mdb
8) Compact and Repair one more time.

*** Executing the DeCompile **EXAMPLE**:
Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
Also, the double quotes are required.

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

For more detail on the Decompile subject ... visit the Master on the subject (and other great stuff) Michael Kaplan:

http://www.trigeminal.com/usenet/usenet004.asp?1033

AND ...
Once you get familiar with the Decompile idea (and ALWAYS make a BACKUP first!) ... you can add both Decompile and Compact/Repair to the Right Click menus in Windows Explorer, which I use multiple times daily:

Getting the Decompile and Compact context menu options
http://access.mvps.org/access/modules/mdl0039.htm

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Well, 99% of the time ... Classic case of Missing References.

Is this an A2010 db?  If so, is it in a Trusted Location ?
0
 
ChrisIT ManagerAuthor Commented:
I agree, which is why I checked the references, and you can see that none are missing.  That's when I got stumped.

This is an Access 2007 DB and it is in a Trusted Location.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
ChrisIT ManagerAuthor Commented:
Decompile did the trick.  Thanks!
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Man, I'm on a roll with Decompile today ... 3x , lol.

cool.mx
0
 
ChrisIT ManagerAuthor Commented:
Haha, that's great.  That Decompile and Compact context menu link looks useful, but the download link on their site is broken.  Do you know of another place I can get it?
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Well, I just got to the link.  The site has been intermittent recently ... try again.  If you cannot get there ... let me know.

Yes ... that is MUST HAVE.  I use it daily.  Be SURE to open in Notepad first and tweak the folder paths for your installation of Access. You can also a entries for ACCDA, ACCDE (Compact only of course) ... and MDB/E/A also.

mx
0
 
ChrisIT ManagerAuthor Commented:
The link to the website works (http://access.mvps.org/access/modules/mdl0039.htm), but on their site, when I click on "Download AccessReg.Reg" I get a 404 file not found error.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
OOPS ... Humm. Bummer.

OK ... attached is the basic file ...with A2010 stuff ... easy to tweak for whatever version .
I renamed .REG to .TXT to upload.  Open in NotePad, tweak as necessary, then change back to .REG and double click to add to Registry.

Quick and simple.

mx
RightClickCompactDecompile2010-W.txt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.