Solved

Access VBA Error - Undefined Function 'Left' in Expression

Posted on 2012-04-04
9
2,248 Views
Last Modified: 2012-04-04
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
0
Comment
Question by:Orcadian
  • 5
  • 4
9 Comments
 
LVL 75
ID: 37809503
Well, 99% of the time ... Classic case of Missing References.

Is this an A2010 db?  If so, is it in a Trusted Location ?
0
 

Author Comment

by:Orcadian
ID: 37809507
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
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 37809508
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Closing Comment

by:Orcadian
ID: 37809530
Decompile did the trick.  Thanks!
0
 
LVL 75
ID: 37809532
Man, I'm on a roll with Decompile today ... 3x , lol.

cool.mx
0
 

Author Comment

by:Orcadian
ID: 37809534
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
 
LVL 75
ID: 37809542
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
 

Author Comment

by:Orcadian
ID: 37809607
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
 
LVL 75
ID: 37809635
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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2016 7 35
Access 2013 DoCmd.TransferSpreadsheet Not Working in Win 10 8 29
How to use DLookup with IsNull Function 4 26
My SQL as Backend for Access 3 18
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question