On Click event procedure skipping the On CLick code (1 Viewer)

gblack

Registered User.
Local time
Today, 14:16
Joined
Sep 18, 2002
Messages
632
So I have this Application that was made by another devloper. There's a button on a form with an On Click event attached to it. The only issue is when I put a break point ANYWHERE in the code... then go back and click the button. It doesn't break.

Additionally, some code runs, because the button actually does stuff... just not the stuff in the On Click event.

I've never seen this before. I showed it to another developer and we're both kind of baffled as to how it would run.

I would post it, but unfortunately I can't for security reasons. So... I was wondering if anyone knew of a way to have the On Click event of a button do something other than what the code in the click event is denoting it should be doing.

As an aside, the On Click event is supposed to set the data up to be pushed as a report. So when I press the button it is pushing data as a report, it just happens to be the wrong data.

She does have some Macros set up... but the event procedure is listed in the properties under ON Click... not macros... but I was thinking maybe the Macros could override it...? I don't... I am kind of grapsing atm.

Of course... any help... greatly appreciated!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:16
Joined
Feb 28, 2001
Messages
26,999
The only time I've ever seen something like that was when somehow the code in question wasn't properly linked to the button. It happened when the button got renamed and then was renamed a second time back to the original name, but by that point the damage was done. Except... the solution was simply to open the form in design view, select the button, bring up the property sheet to the event page, and click the OnClick event to verify that it was set for "[Event Procedure]" - and then double click that property so as to bring up the code associated with the event. That sequence relinked the OnClick event to the code.

That's the ONLY time I've ever seen that. But if the code in question seems to be working, I wonder if you have been looking at an entry point name tainted by a spelling error or something like that. In other words, looking at old code when code exists for a different name.

Yes, it is a long shot. But it might explain the facts.
 

AlexHedley

Registered User.
Local time
Today, 14:16
Joined
Aug 28, 2012
Messages
171
If you import the form into another blank new database does it act strangely there too?
 

gblack

Registered User.
Local time
Today, 14:16
Joined
Sep 18, 2002
Messages
632
Actually what happened is (unbeknownst to me) there were several possible Child/subforms that all look the exact same, which can be actived, based upon the choices one makes in the Parent/Main Form. The button in question is location on the subform.

So when I pulled up the main Form in design mode... the default subform appears. I put breaks on that Subform button's event procedure... Then ran the main form, but I didn't choose the correct option in the main form, so the underlying subquery would be different, although looking exactly the same as the subform I was trying to add breakpoints to.

Thusly I was clicking the button and things happened, instead of hitting an immediate breakpoint.
 

Users who are viewing this thread

Top Bottom