~Erica~
:
First of all, be sure Option Explicit appears at the top of each
module,
just under Option Compare Database. If you need to add this manually
to
each code module, change the option by going to Tools > Options in the
VBA
editor. Click the Editor tab, and check the box for Require Variable
Declaration. Try to compile.
It looks like the right format for the decompile, but be sure that is
the
actual path to Access.exe. Here is another link to well-explained and
thorough instructions:
http://allenbrowne.com/recover.html
However, I cannot say whether decompiling and all the rest will solve
the
problem. If your code works sometimes and not at other times it is
not
likely because of a compile error. It is more likely because the code
does
not recognize a variable or field it is being called upon to use.
With
error handling you can identify the event containing the troublesome
code.
Once you know that you can set a break point in order to step through
the
code one line at a time.
To set a break point, open the code editor. Click the vertical bar
just
to
the left of the code window. A red dot should appear, and the line of
code
will be highlighted. Run the code by whatever means necessary (for
instance, if the code with the break point is in a command button
Click
event, open the form and click the command button; if it is in a combo
box
After Update event, make a selection from the combo box; etc.) The
code
will pause at the break point. Press the F8 key to move to the next
line
of
code. Hover the mouse over field names and variables to be sure they
are
what they should be. This technique, combined with error handling
code,
should allow you to pinpoint errors. Once you know what they are you
can
either solve the problem or post a specific question.
Ok, THIS is the right path:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" /decompile
"c:\Documents and Settings\EMM\My
Documents\TestDatabase_6_5_08.accdb"
I just cannot get anything to work....
~Erica~
:
Decompile is a command line option. For more information see:
http://www.granite.ab.ca/access/decompile.htm
Once code has compiled the option to compile it is not available.
If
you
edit a line of code (backspacing one character, then retyping it
should
be
enough) you will have the compile option available again, but if
the
code
has compiled then any problems with the code lie elsewhere, so
there's
not
much point to doing this.
For error handling there is a fine freeware utility that can insert
error
handling at the click of a button, as well as performing a lot of
other
tasks:
http://www.mztools.com/v3/mztools3.aspx
Well I compiled and it found one error. I couldn't find a
decompile
option
though, so I did a compact and repair, closed the file and
re-opened
it
to
compile once more. I no longer have the option to compile the
code
anymore.
Does this mean that it is good? I'm going to be testing my forms
out
again,
but why couldn't you compile it again if you wanted to?
Also, I have some error handling, I'll work on creating more to
see
if
anything else comes up.
~Erica~
:
Go into the code editor and go debug/compile. If your code has
errors
in
it,
it won't compile. I will stop at every error until you fix the
problem.
If
you have already compiled, try decompiling and running compact
and
repair
then re-compile.
:
Hello,
I have been creating a database for the past 5 months and I
have
alot
of VB
code going on throughout various forms and reports. The code
that
I
have
works while I am testing it, but ocationally, certain lines of
code
or
events
in general will not execute. Sometimes acesses totally freezes
up.
For
instance, if I try to send and e-mail, open a form, then
close
another
form;
sometimes the e-mail wont send, or other times the form will
not
open.
In the end, My users will be using Access through all of the
forms I
have
created. I need the navigation to work no matter what... Has
anyone
ever
gotten into this situation? I just need to know what I can do
to
make
my VB
code execute smoothly...
If anyone has any suggestions, please let me know, thank you!
~Erica~