Unable to use Functions in Queries

  • Thread starter Thread starter Luke
  • Start date Start date
L

Luke

Whenever I add a function to a query ie. len, left, right,
mid etc and try and run the query I get an error "Compile
Error. in query expression ***"

The query I am trying to run is

SELECT LEFT(tbl_investor.investor_name,2)
FROM tbl_investor;
 
Luke said:
Whenever I add a function to a query ie. len, left, right,
mid etc and try and run the query I get an error "Compile
Error. in query expression ***"

The query I am trying to run is

SELECT LEFT(tbl_investor.investor_name,2)
FROM tbl_investor;
Luke,
Open any module in Design view, or press Ctrl + G.
On the Tools menu, click References.
Click to clear the check box for the type library or object library
marked as "Missing:."

An alternative to removing the reference is to restore the referenced
file to the path specified in the References dialog box. If the
referenced file is in a new location, clear the "Missing:" reference
and create a new reference to the file in its new folder.

See Microsoft KnowledgeBase articles:
283115 'ACC2002: References That You Must Set When You Work with
Microsoft
Access'
Or for Access 97:
175484 'References to Set When Working With Microsoft Access' for
the correct ones needed,
and
160870 'VBA Functions Break in Database with Missing References' for
how to reset a missing one.
 
Whenever I add a function to a query ie. len, left, right,
mid etc and try and run the query I get an error "Compile
Error. in query expression ***"

The query I am trying to run is

SELECT LEFT(tbl_investor.investor_name,2)
FROM tbl_investor;

Three suggestions:

Open any VBA module (or just type Alt-F11 to open the VBA editor) and
select Debug... Compile <project name>; fix any compile errors.

Then, compact and repair the database.

This may also be the very common References bug. Open any
module in design view, or open the VBA editor by typing
Ctrl-G. Select Tools... References from the menu. One of the
..DLL files required by Access will probably be marked
MISSING. Uncheck it, recheck it, close and open Access.

If none are MISSING, check any reference; close and open
Access; then uncheck it again. This will force Access to
relink the libraries.
 
Back
Top