Undefined function in expression error (1 Viewer)

NikBab

New member
Local time
Today, 17:53
Joined
Sep 16, 2019
Messages
6
Hello,

I have an accdb file created with Access 2016 which contains some custom functions in standard modules.
This file is converted to accde format and used as a reference to a second accdb file also created with
Access 2016 which contains forms,reports, tables etc.
For clarity, let's assume that the first file is named A.accdb. This file is converted to A.accde
The second file is named B.accdb. So, A.accde is referenced by B.accdb
In B.accdb, I have created a select query that uses the custom function 'test' which is defined in A.accde
Both files (A.accde and B.accdb) are deployed to user machines with access 2016 runtime version.
In one of these machines the user gets the error "Undefined function 'test' in expression" when the query
in B.accdb that utilizes function 'test' is executed.
This error does not occur if B.accdb references A.accdb instead of A.accde, however the file A.accdb
cannot be distributed to the end user.
Moreover the user machine has full Access 2007 installed

Could you please provide any guidance on how to resolve this situation?

Thank you very much in advance.

Best Regards
 

Ranman256

Well-known member
Local time
Today, 12:53
Joined
Apr 9, 2015
Messages
4,337
This false error usu happens when a user has different Office ver. or system files.
check the vbe (alt-F11), tools , references.
If a checked item says MISSING, uncheck it , and slide down to find their version.
check that , then compile.
it should work then.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:53
Joined
May 21, 2018
Messages
8,527
I would try to fully qualify it. If I understand correctly A.accde is added as a referenced code library. If so then Look at the project name in the VB project explorer window. So to fully qualify it use the projectname.moduleName.functionName
My code library is "Fractions"

fully.png


After rereading, you could try this but I doubt this will be a fix. I tried to replicate the issue and there is no problem.
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 09:53
Joined
Oct 29, 2018
Messages
21,467
In B.accdb, I have created a select query that uses the custom function 'test' which is defined in A.accde
You could try the following... Create a public function in B.accdb to return the result of the function from A.accdb and then use that new function from B.accdb in your query. Hope that makes sense...
 

NikBab

New member
Local time
Today, 17:53
Joined
Sep 16, 2019
Messages
6
Hello,

I apologize for the late response but I was away for a few days and could not see your posts.
Thank you all very much for your suggestions!

I tend to believe that the problem has something to do with different Office versions that Ranman256 pointed out.
As I mentioned in my previous post, the problem occurs only in one particular machine. The user of this machine
told me that he originally had Office 97 installed, which was upgraded to Office 2003 and later on to Office 2007 which
is the current version. He also mentioned that we reinstalled Office 2007 but nothing has changed.
I opened B.accdb with Access 2007 on his machine (which is the only full version of ms access that this particular computer has)
but when I tried to check the references, I get the message 'The Visual Basic for Applications project in the database is corrupt'
and the code library A.accde appears as MISSING.
However, I believe that this is misleading since B.accdb can be opened with Access Runtime 2016 which is deployed with
B.accdb, without any message about corruption

Do you have any suggestion regarding system or MS Office file(s) that may be related to this particular problem?

Thank you very much in advance
 

oleronesoftwares

Passionate Learner
Local time
Today, 09:53
Joined
Sep 22, 2014
Messages
1,159
You can access the reference menu in vba, by pressing ALT+F11, going to Tools.
 

Users who are viewing this thread

Top Bottom