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.