Error: "Unknown Function Name" (1 Viewer)

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
My project no longer works because my UDFs no longer work.

What's really weird, is that UDFs are disabled completely in Access at this point. What I mean is, I can open up a new MDB file, with no tables, no code, nothing, and then create a simple module with one function:

Public Function Testing()
Testing = "Hello World"
End Function

And then if I paste into SQL view

SELECT Testing()


I get the error msg "Unknown Function Name". I can't create a UDF in any sense whatsoever. The same code works fine on my computer at home (Access 2003). On the job it fails (Access 2003). I would like to uninstall Access and reinstall it but, at work, I can't do so for lack of privileges (I can't even get my hands on the company's Office CD), and the jerks in our company's IT dept won't help me do anything technical -they have job security issues. (I'm not in IT).

Any suggestions, anyone?
 

WayneRyan

AWF VIP
Local time
Today, 00:06
Joined
Nov 19, 2002
Messages
7,122
Jal,

Unfortunately, the References have reared their ugly head. Use the Search
Facility here and look for "References".

Wayne
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
I've been trying some of the suggestions found in those Reference articles. (Some of them I haven't fully understood so I am still working on this).

But all the while I've been skeptical this is the problem. Here's why. If you look at the scenario I described above, there are no references involved. I'm talking about opening a brand new MDB file, creating a one-line module, and then pasting a simple SELECT into sql view. So I don't understand. In so doing, what have I "referenced" ? What "references" could I have set incorrectly? As far as I can see, no references are involved in this scenario.
 

Rabbie

Super Moderator
Local time
Today, 00:06
Joined
Jul 10, 2007
Messages
5,906
Just a thought. Make sure your function and the module it is stored in have different names. Ie dont store function Testing in a module called Testing.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
Thanks for the suggestion, but to date I have only used the name Module1 ]for my standard Modules.

The only time I changed the default name was with a class module.

In the testing scenario above, there is no class module, just a standard module. Again, here at home (I am at home now), the code works fine.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
This article is commonly cited about references:

http://www.mdbmakers.com/forums/showthread.php?t=2757

It talks about going to Tools > References and looking to see if any of the referenes are marked MISSING. Well, maybe I'm "missing" it, because I had already seen this suggestion in other articles, while at work, and had gone to Tools > References, and saw nothing of the kind.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
Ok, I'm getting closer. At first I thought I needed a service pack for office but it tells me "already installed."

The next thing I tried was reducing the Security from "High" to "Low". The code runs fine on this setting but I don't want to keep it there.

The question, then, is this, is there a way to continue to use UDFs even with High security setting?
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
This probably has something to do with sandbox mode which requires Jet service pack 8. I tried to install that and get an "already installed" msg.

If I understand it, I should be able to enable sandbox box mode by simply clicking NO to the question, "Do you wish to block unsafe expressions." So I clicked NO, but the app still crashed at the UDF. Same result when I click YES.

Apparently sandbox mode is supposed to allow VBA execution even on high security setting, unless the code is particulary dangerous. There is nothing dangerous in my UDF - it's just string manipulation. It compare two names to determine if they are the "virtually" same - I need the UDF only because there might be a slight spelling error in one version of the name, so it takes steps to verify that the two names are "mostly" the same, such as:

Johnathan Smith
Jonathan Smith
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
I would think that the digital signature would be enough to deal with all this stuff, even though it is a self-signed project.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
Ok, I'm getting closer (dont' know how I got there).

Now when it opens up, it asks me, "Do you wish to block unsafe expression." I click "No", and the code works. The msg is annoying, though, but I haven't figured out how to disable it.

Security is set to high and I want to keep it there.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:06
Joined
Feb 28, 2001
Messages
27,167
Did you compile the code before you self-signed it? Not sure, but I believe that you need to sign the compiled code, not the raw text. In this case, Access is as dumb as a post because the code it compiles was self-contained inside of the database. But if you have auto-compile situations because you didn't store the compiled code, what it LOOKS like to Access is that something has inserted compiled VBA into your datase.

Not sure that is helpful, but it is at least really cheap and easy to try.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
The "High" security setting is scary. Now, if I try to create a brand new MDB file on my desktop, it won't open !!! Tells me, "Can't open this document because it's not digitally signed" !!!

Thank God I have a digitally signed MDB file (an old project) - I first have to open that one and turn security back to low and THEN I can open the new project. So what happens if I accidentlally delete my old MDB file? I'll no longer have the option to set security to low. Apparently, that means I'll be locked out of Access forever! WTF?

Bottom line, I'm beginning to suspect that Access security is bug-ridden.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
Well, now it seems the core issue isn't High or Low security but whether unsafe expressions are blocked. I am now having the same UDF crashes even in low security if unsafe expressions are blocked.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
The "High" or "Low" security issue is apparently a factor only in the sense that changing this setting pops up an option to block or unblock unsafe expressions.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
So, at this point, it looks like I wil have to permit unsafe expressions in order to enable my UDFs. That's odd, because sandbox mode, as I understqand it, is supposed to permit safe UDFs and only block those with unsafe, dangerous method calls.

Stated differently, why isn't sandbox mode coming into effect? I feel like I've tried all the "Yes" and "No" options already, so I don't see how I could have missed out on it.
 

jal

Registered User.
Local time
Yesterday, 16:06
Joined
Mar 30, 2007
Messages
1,709
Did you compile the code before you self-signed it? Not sure, but I believe that you need to sign the compiled code, not the raw text. In this case, Access is as dumb as a post because the code it compiles was self-contained inside of the database. But if you have auto-compile situations because you didn't store the compiled code, what it LOOKS like to Access is that something has inserted compiled VBA into your datase.

Not sure that is helpful, but it is at least really cheap and easy to try.

Didn't mean to ignore you - it's just that I later concluded that it was an issue of "unsafe code" rather than digital signatures. I'm going to start another thread about signatures, since I have a question on that as well.
 

Users who are viewing this thread

Top Bottom