unknown function dir()

G

Guest

Our client is having trouble running an Access application, which I believe
is due to "unsafe expressions" being blocked. The error message is "unknown
function dir()". There are no missing or broken references. He is running
Windows XP SP2 and is logged on as an Administrator. He is running Access
2003, no other versions of Access exist on the machine, nor has Access been
upgraded from any previous version on that machine - it was a new PC, brand
new image. When developing our app we work in Access 2003 but use Access
2000 file format. I asked him to set macro security to low and restart
access - no luck. Next, I asked him to set the macro security settings to
low, then to high, and then back to low again in an attempt to force one of
the 2 usual messages to appear ("do you want to allow" or "do you want to
block" unsafe expressions), but these messages never appeared. I asked him
to check for the sandbox key in the registry - he found it and set it to 0,
rebooted, tried again and still no luck. I asked him to check his version of
Jet by searching for the file "msjet40.dll", right clicking on it and
choosing Properties, and looking on the Version tab. He has 4.0.8618 which
should be adequate. Does anyone have any ideas about what the problem could
be? We were thinking of asking him to reinstall Access next but thought
there might be something else we could check first.. Thank you for your help.
 
T

TC

It sounds like a VBA error to me. If you can change the sourcecode, I
suggest putting some msgbox()es in the code to locate where the error
lies. I just use MsgBox 11, MsgBox 22, MsgBox 33 etc. - no need for
MsgBox "Line 2073 in procedure BlahBlah in module BlobBlob" etc.

HTH,
TC
 
G

Guest

Just as an additional note, the code works fine on other computers. It's
just this one computer that we currently are having trouble with.
 
G

Guest

TC,

We have error trapping in every module and line numbers on every line of
code. We do know exactly where the error is at. The problem is we don't
know why. This program as been used for almost 2 years now without any
problem. We are just having problems with this one computer and know it has
something to do with security. If you have any ideas along this line it
would be appreciated.

Thanks

Gary
 
K

Ken Snell [MVP]

I would agree with your thought about the problem being the security in
ACCESS 2003. Dir is one of the functions that is blocked in Jet 4.0 in
ACCESS 2003 when the sandbox mode is set to "highest" security.

See this Knowledge Base article for more information about the sandbox's
effects:
http://support.microsoft.com/?id=294698

If your client is not able to modify the behavior by changing the security
levels, then it's possible that there is a reference problem even if you
don't see any references marked as "MISSING" or broken in the References
list. Try following these steps (from a post by Douglas Steele, MVP):

This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

For far more than you could ever want to know about this problem, check out
ttp://www.accessmvp.com/djsteele/AccessReferenceErrors.html

--

Ken Snell
<MS ACCESS MVP>
 
T

TC

Uh, you know the line of code that the error occurs on?

Could you, er, (gasp), show us that line??

TC
 
G

Guest

TC,

Now you have gone to being rude. Maybe you haven't been reading very
clearly. The code in question WORKS FINE on all other computers except this
one. In fact it has been working fine for over two years. It IS NOT a code
error but something to do with security. We have had this problem before but
it is usually fixed by setting the Micro Security to Low in Access 2003.
However, in this case, this doesn't fix the problem. However, if it will
make you happy here is the line of code.

t = Dir("C:\Appfolder\*", vbDirectory)

A really complex line of code isn’t it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top