Code only executes when stepping through

R

RD

Hi all,

It seems to me I've seen this before but a search didn't turn up anything.

I've got a section of code that will only execute if I put a breakpoint
somewhere above it and then step through. When I remove the breakpoint and just
allow the sub to run it blows right through and won't execute the code. In this
case it's a simple If_Then that checks the value of a variable and exits the sub
if True.

What would cause this?

Thanx,
RD
 
D

David C. Holley

I seem to recall this (vaguely). To prove wether or not the code
executes. Place statements through out at key points such as

Debug.Print "---MARK 1---"
Debug.Print "---MARK 2---"

This will cause the text to appear in the Debug window. Of course,
you'll want to do

Debug.Print "---Calling mySub---"

before the statement that is supposed to call the code such as...

Sub Form_Open()
Debug.Print "---Calling Snooper---"
End Sub

Sub Snooper()
Debug.Print "---Snooper Called----"
Code:
Debug.Print "---Snooper Completed---"
End Sub

This will also confirm wether or not the If...Then is true as in ...

If a = 1 then
Debug.Print "---MARK 1---"
end if

I also have been known to dump the value to the debug window just so I
can see it myself as in...

Debug.Print "Value A: " & a
If a = 1

and what not.
 
R

RD

Hi all,

It seems to me I've seen this before but a search didn't turn up anything.

I've got a section of code that will only execute if I put a breakpoint
somewhere above it and then step through. When I remove the breakpoint and just
allow the sub to run it blows right through and won't execute the code. In this
case it's a simple If_Then that checks the value of a variable and exits the sub
if True.

What would cause this?

Thanx,
RD

Gaa! I wrote this a couple of weeks ago. My news server was messing up and
this sat in my outbox. Anyway, I don't even remember what I did but it's
behaving properly now.
 

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