Access Form: Click Event Does not Fire?

  • Thread starter Thread starter Smartin
  • Start date Start date
S

Smartin

Greetings All,

Using A2003, WinXPPro environment. I have a form with three buttons.
The form has click event code for each button. Two of the buttons work
fine. Click event code runs as prescribed.

The third button does not work, and I can't find any reason why. By
"does not work" I mean nothing seems to happen when the button is
clicked. However, if I place a breakpoint on the first line of code
for this this button, execution is stopped on the breakpoint. Resuming
execution processes the remaining code as expected.

So why does the third button click event not fire unless a breakpoint
is set?

FWIW this MDB is compacted/repaired automatically every time it closes.
 
Try adding the command DoEvents at the beginning of the on click event code.
It sounds like some kind of timing problem. DoEvents can sometimes overcome
that.

UpRider
 
However DoEvents also makes code reentrant, and clicking the button
several times may cause several stack frames to be executing at the
same time. Hardly ever what the innocent developer intended.

I would like to ask the OP to debug this by commenting out all code in
the click event, replacing it with a single Hello World messagebox. If
that works, the problem is with the code itself, and he/she should
post it so we can comment on it.

-Tom.
 
Back
Top