PC Review


Reply
Thread Tools Rate Thread

Access 2003 Click Event not firing first time.

 
 
Slick Willy
Guest
Posts: n/a
 
      11th Apr 2009
I have some Command Buttons on a form with several tabbed subforms. If
I click the Command Button once the screen flickers, but the event
does not fire. If I click a button a second time it does fire. I've
tried debugging the event but the code is never reached. I've rebuilt
the form and tried adding a new button, but the result is the same. If
I put the code in the On Enter event it fires the first time.

I'll try playing with the initial focus, but any ideas/workarounds
appreciated.

 
Reply With Quote
 
 
 
 
Ken Snell MVP
Guest
Posts: n/a
 
      11th Apr 2009
Are the command buttons in a subform? That behavior can occur in these
situations, as the subform first must get the focus and then the command
button can get the focus -- a two-step process.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"Slick Willy" <(E-Mail Removed)> wrote in message
news:f3f92c2e-bf6d-4564-9ea5-(E-Mail Removed)...
>I have some Command Buttons on a form with several tabbed subforms. If
> I click the Command Button once the screen flickers, but the event
> does not fire. If I click a button a second time it does fire. I've
> tried debugging the event but the code is never reached. I've rebuilt
> the form and tried adding a new button, but the result is the same. If
> I put the code in the On Enter event it fires the first time.
>
> I'll try playing with the initial focus, but any ideas/workarounds
> appreciated.
>



 
Reply With Quote
 
Slick Willy
Guest
Posts: n/a
 
      12th Apr 2009
On Apr 11, 3:44*pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
wrote:
> Are the command buttons in a subform? That behavior can occur in these
> situations, as the subform first must get the focus and then the command
> button can get the focus -- a two-step process.
>
> --
>
> * * * * Ken Snell
> <MSACCESSMVP>http://www.accessmvp.com/KDSnell/
>

No, The Command buttons are on the Main form. If I call the Click
Event from the Got Focus event it works. I have to put a stop in the
Focus event to see what's happening, but I suspect it's just quiting.
I had a timer, but turning it off had no effect. I also went throught
to make sure all my Error code was set to zero at the end of each
call, but this did not turn anything up either.
 
Reply With Quote
 
Slick Willy
Guest
Posts: n/a
 
      12th Apr 2009
On Apr 11, 9:18*pm, Slick Willy <will_st...@yahoo.com> wrote:
> On Apr 11, 3:44*pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
> wrote:> Are the command buttons in a subform? That behavior can occur in these
> > situations, as the subform first must get the focus and then the command
> > button can get the focus -- a two-step process.

>
> > --

>
> > * * * * Ken Snell
> > <MSACCESSMVP>http://www.accessmvp.com/KDSnell/

>
> No, The Command buttons are on the Main form. If I call the Click
> Event from the Got Focus event it works. I have to put a stop in the
> Focus event to see what's happening, but I suspect it's just quiting.
> I had a timer, but turning it off had no effect. I also went throught
> to make sure all my Error code was set to zero at the end of each
> call, but this did not turn anything up either.


I just realized the that the Form Load Event is not firing either. The
Form Load fires on the first click to the form and then the Click
Event fires on the second click.
 
Reply With Quote
 
Ken Snell MVP
Guest
Posts: n/a
 
      12th Apr 2009
Let's see all the code in the form's module. Some event is causing a loss of
focus from the button or form for the first click.

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"Slick Willy" <(E-Mail Removed)> wrote in message
news:f7c4d0b8-9719-4166-939d-(E-Mail Removed)...
On Apr 11, 9:18 pm, Slick Willy <will_st...@yahoo.com> wrote:
> On Apr 11, 3:44 pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
> wrote:> Are the command buttons in a subform? That behavior can occur in
> these
> > situations, as the subform first must get the focus and then the command
> > button can get the focus -- a two-step process.

>
> > --

>
> > Ken Snell
> > <MSACCESSMVP>http://www.accessmvp.com/KDSnell/

>
> No, The Command buttons are on the Main form. If I call the Click
> Event from the Got Focus event it works. I have to put a stop in the
> Focus event to see what's happening, but I suspect it's just quiting.
> I had a timer, but turning it off had no effect. I also went throught
> to make sure all my Error code was set to zero at the end of each
> call, but this did not turn anything up either.


I just realized the that the Form Load Event is not firing either. The
Form Load fires on the first click to the form and then the Click
Event fires on the second click.


 
Reply With Quote
 
Slick Willy
Guest
Posts: n/a
 
      13th Apr 2009
On Apr 12, 2:39*pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
wrote:
> Let's see all the code in the form's module. Someeventis causing a loss of
> focus from the button or form for the firstclick.
>
> --
>
> * * * * Ken Snell
> <MS ACCESS MVP>http://www.accessmvp.com/KDSnell/
>
> "SlickWilly" <will_st...@yahoo.com> wrote in message
>
> news:f7c4d0b8-9719-4166-939d-(E-Mail Removed)...
> On Apr 11, 9:18 pm,SlickWilly<will_st...@yahoo.com> wrote:
>
>
>
>
>
> > On Apr 11, 3:44 pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
> > wrote:> Are the command buttons in a subform? That behavior can occur in
> > these
> > > situations, as the subform first must get the focus and then the command
> > > button can get the focus -- a two-step process.

>
> > > --

>
> > > Ken Snell
> > > <MSACCESSMVP>http://www.accessmvp.com/KDSnell/

>
> > No, The Command buttons are on the Main form. If I call theClick
> >Eventfrom the Got Focuseventit works. I have to put a stop in the
> > Focuseventto see what's happening, but I suspect it's just quiting.
> > I had a timer, but turning it off had no effect. I also went throught
> > to make sure all my Error code was set to zero at the end of each
> > call, but this did not turn anything up either.

>
> I just realized the that the Form LoadEventis not firing either. The
> Form Load fires on the firstclickto the form and then theClickEventfires on the secondclick.- Hide quoted text -
>
> - Show quoted text -


Yeah, I was thinking it's a focus problem too. So I went through all
of the set focus events in the subforms. Once I changed the set focus
in the subform to the parent form it all loads. But the command
buttons disable themselves and some other buttons when clicked
depending on the operation. So I have to be careful what has the focus
when clicking a particular button. I ended up checking to see if the
main form is loaded and setting focus to the form if not loaded,
otherwise I set the focus to a command button that won't get disabled
during that particular event.

Thanks for the help.

 
Reply With Quote
 
Ken Snell MVP
Guest
Posts: n/a
 
      14th Apr 2009
You can check the Enabled property of a control before you try to set focus
to it. If Enabled property is True, then it can receive the focus.
--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/


"Slick Willy" <(E-Mail Removed)> wrote in message
news:8e319e68-d451-46b0-a3e2-(E-Mail Removed)...
On Apr 12, 2:39 pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
wrote:
> Let's see all the code in the form's module. Someeventis causing a loss of
> focus from the button or form for the firstclick.
>
> --
>
> Ken Snell
> <MS ACCESS MVP>http://www.accessmvp.com/KDSnell/
>
> "SlickWilly" <will_st...@yahoo.com> wrote in message
>
> news:f7c4d0b8-9719-4166-939d-(E-Mail Removed)...
> On Apr 11, 9:18 pm,SlickWilly<will_st...@yahoo.com> wrote:
>
>
>
>
>
> > On Apr 11, 3:44 pm, "Ken Snell MVP" <kthsneisll...@ncoomcastt.renaetl>
> > wrote:> Are the command buttons in a subform? That behavior can occur in
> > these
> > > situations, as the subform first must get the focus and then the
> > > command
> > > button can get the focus -- a two-step process.

>
> > > --

>
> > > Ken Snell
> > > <MSACCESSMVP>http://www.accessmvp.com/KDSnell/

>
> > No, The Command buttons are on the Main form. If I call theClick
> >Eventfrom the Got Focuseventit works. I have to put a stop in the
> > Focuseventto see what's happening, but I suspect it's just quiting.
> > I had a timer, but turning it off had no effect. I also went throught
> > to make sure all my Error code was set to zero at the end of each
> > call, but this did not turn anything up either.

>
> I just realized the that the Form LoadEventis not firing either. The
> Form Load fires on the firstclickto the form and then theClickEventfires
> on the secondclick.- Hide quoted text -
>
> - Show quoted text -


Yeah, I was thinking it's a focus problem too. So I went through all
of the set focus events in the subforms. Once I changed the set focus
in the subform to the parent form it all loads. But the command
buttons disable themselves and some other buttons when clicked
depending on the operation. So I have to be careful what has the focus
when clicking a particular button. I ended up checking to see if the
main form is loaded and setting focus to the form if not loaded,
otherwise I set the focus to a command button that won't get disabled
during that particular event.

Thanks for the help.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Click Event not firing Abbas Microsoft ASP .NET 1 14th Jul 2007 06:02 AM
firing button click event before page load event.....???? GauravGupta Microsoft ASP .NET 3 2nd Jul 2007 01:14 PM
LinkButton click event not firing Mel Microsoft ASP .NET 6 12th Jun 2007 02:23 PM
Click event on menu item is lost after first time firing of the event mayuresh.kasture@gmail.com Microsoft Excel Programming 1 2nd Apr 2007 01:25 PM
click event not firing =?Utf-8?B?Z3V5?= Microsoft VB .NET 1 14th Jun 2006 05:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:36 PM.