
Signature
Alex Dybenko (MVP)
http://Alex.Dybenko.com
Alex,
Thanks, that helped to get things started. Have hit a couple of snags,
though:
First, one of the forms on which I would like to use this has a TabControl
with four tab pages. There is no GotFocus() event for the tab pages. I
cannot for the life of me figure out where to put the code to get it to fire
when you either click on the tabs or use the accelerator keys or use the
arrow keys to travel between them...
Second, when I click the button on the main switchboard to launch a form (a
different one than the one with the TabControl; this one has a subform. And
it is the one that seems to work with your suggested code...) I get a
runtime error:
2474: The expression you entered requires the control to be in the active
window
Clicking DEBUG highlights the single line of code in the SetStatusBar
function.
If I click the reset button, the VBE closes and the form reappears. And
everything seems to be fine. It works as it should.
This being the case, should I just trap that error and ignore it?
One other thing; I'm not sure if this has any bearing on the error, but when
the form opens, the focus is already in the single control on the main form
that has this code attached to it: a combo box which chooses the record to
be displayed in the subform. I don't think the form recognizes the combo box
as the active control though because the code doesn't fire when the form is
opened. (There is no message in the custom status bar. But once you return
to this control, the code does work. The status bar text shows up in the
custom status bar.)
Thank you so much for responding. I hope you have a couple more suggestions
to address the above questions.
lj
> i think you can make a public function SetStatusBar() in form class module,
> write there:
[quoted text clipped - 37 lines]
> > Thanks in advance,
> > lj
Alex Dybenko - 28 Feb 2004 18:48 GMT
Hi,
> First, one of the forms on which I would like to use this has a TabControl
> with four tab pages. There is no GotFocus() event for the tab pages. I
> cannot for the life of me figure out where to put the code to get it to fire
> when you either click on the tabs or use the accelerator keys or use the
> arrow keys to travel between them...
i think you can use Change event
> Second, when I click the button on the main switchboard to launch a form (a
> different one than the one with the TabControl; this one has a subform. And
[quoted text clipped - 11 lines]
>
> This being the case, should I just trap that error and ignore it?
i think you can just add at the begining of SetStatusBar:
on error resume next
> One other thing; I'm not sure if this has any bearing on the error, but when
> the form opens, the focus is already in the single control on the main form
[quoted text clipped - 4 lines]
> to this control, the code does work. The status bar text shows up in the
> custom status bar.)
not sure, but maybe try to call SetStatusBar in activate event of form

Signature
Alex Dybenko (MVP)
http://Alex.Dybenko.com