Option Explicit

J

JimP

An mdb is deployed among a group of users. Option Explicit is not specified
in modules and variables are not defined.

For one user, code crashes everytime it tries to execute a statement with an
undefined variable.

One solution is to define the variables, but that doesn't explain why it is
happening.
 
A

Albert D. Kallal

I would first go into the code, and do a debug-compile....

If the code compiles, then convert the mdb to a mde, and try that....
For one user, code crashes everytime it tries to execute a statement with
an undefined variable.

Often, it can be a references issues. does the code compile on that users
station?
One solution is to define the variables, but that doesn't explain why it
is happening.

Well, it possible the code is not compiled when you distribute it, or even
worse, some references are missing. As mentioned, try compiling the code on
that users station..and see what occurs.

On the other hand, as a general rule, you should send out a compiled mde to
each user..they run faster, load faster, can't become un-compiled...and the
list goes on.....

And, if you have any automation code (with references to word, excel etc,
change them to late binding)
 
J

JimP

This is the first where I've code become docompiled upon distibution. Is
this fairly commonplace?
 
A

Albert D. Kallal

JimP said:
This is the first where I've code become docompiled upon distibution. Is
this fairly commonplace?

I have a difficult enough time keeping a regular mdb in a compiled state
even on my development machine. I can't say it's common, but it does often
happen. perhaps it's also possible that it ws un-compiled on your machine
*before* you distributed.

References and a few things can be different on different machines, and thus
simply launching the program can cause some references of things to be
changed, or worse broken (and I believe if that point when those references
break, you'll have some code that is un compiled at that point). If you
distribute a mde, then this problem is completely eliminated.

Furthermore if you distribute a mdb, them any time the user slips something
into design mode, then you've got parts of your application that will become
instantly uncompiled.

At the end of the day it's really a question of reliability, and exercising
more caution by using a mde. Users can't accidentally change code or forms,
and another terrific added bonus of using a mde is that both your local and
global variables DO NOT reset if there is a un-trapped error. This fact
alone means that using a mde is considerably more reliable as any global or
local variables will NEVER become reset by on handled errors...the code just
keeps on running with all values intact....
 
R

Robert Morley

Albert said:
At the end of the day it's really a question of reliability, and exercising
more caution by using a mde. Users can't accidentally change code or forms,
and another terrific added bonus of using a mde is that both your local and
global variables DO NOT reset if there is a un-trapped error. This fact
alone means that using a mde is considerably more reliable as any global or
local variables will NEVER become reset by on handled errors...the code just
keeps on running with all values intact....

Interesting, I wasn't aware of that. On the other hand, if you distribute
an MDE, there's absolutely no possibility of using NetMeeting to take over a
user's desktop and finding out what line the error is occurring on, so I
guess it becomes a question of what you need more, and how good your users
are at reporting errors. :)


Rob
 

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

Top