Breakpoints in VBA

D

David

Hello,
one application of mine doesn't respect breakpoints and runs always till the
end of code. How can I force code to stop at breakpoints ?
Thanks for your help.
David
 
D

Daniel Pineault

David,

You would need to supply us with your code to review.

Also, in 8+yrs of coding this has never occured. It is most likely that you
have a conditional statement that is not evaluating as you expected ...

One approach I use when i have such problems is to set a break point at the
very first line in my routine and then run the code line by line until I
identify the source of my problem. While doing this evaluate your variable
and ensure that they are giving the results you expected and coded for. this
can be teadeous, but you will no doubt identify the underlying source of your
problem.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
J

John Spencer (MVP)

I've seen this on a few occasions.

Try the following until something works.
-- Open the VBA window and select Clear All Breakpoints from the debug menu
-- Open the Options (Tools: Options) and check the general tab options for
error breaks

-- Decompile your database and then compact
-- Now compile your code
You can use the decompile method to attempt a fix.

Check out the following:

http://www.mvps.org/access/bugs/bugs0008.htm

They are written for Access97 (the same method works for Access2000 and
Access2002, Access 2003).

Be sure to make a copy of your mdb before you decompile. I've never had any
trouble but ...

Last resort
-- create a new database and import everything into it.


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
D

Dirk Goldgar

David said:
Hello,
one application of mine doesn't respect breakpoints and runs always till
the
end of code. How can I force code to stop at breakpoints ?


If you have the Startup option "Use Access Special Keys" un-checked, then
breakpoints will not be respected. Could that be the case for this
database? In Access 2007, this would be among the "Current Database"
options, but I can't recall if the option has the same name.
 
M

MikeJohnB

just in case you are not aware and in support of Daniel's answer, press F8 to
single step your code. Also, you can type the word Stop in between lines of
code but it does the same as a breakpoint.
 
D

David

Hello Dirk,
your clue solves my problem.
Thank you for your help.
David

Dirk Goldgar píše:
 

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