Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / February 2004

Tip: Looking for answers? Try searching our database.

StatusBar control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lj - 26 Feb 2004 02:23 GMT
I posted this several days ago in another ng; got no response so I am hoping
someone here can help me:

As part of the learning experience, I placed one of the 'more controls' from
the  Toolbox onto my form - the StatusBar control. I like the idea of having
the
status bar on the actual form rather than the default one at the bottom of
the screen (my forms are all around 7" x 5", auto-centered and do not
maximize) This would bring the helpful hints closer to the user's eye
level...

I am wondering if there is a way to write code in one place that will tell
each of the controls to use their own status bar text as the source for the
custom control.

If I code each individual control's GotFocus() to be:

   Me.sbrMyStatusBar.Panels(1).Text = [CtlName].StatusBarText

it works. But that is very tedious. And the text of the custom status bar
does not return to blank or default once you leave the control; do I have to
also write code for each LostFocus() event?

Hoping someone has played around with this control a little....
(Access 2003, StatusBar control version 6.0, .mdb is in A2003 format)

Thanks in advance,
lj
Alex Dybenko - 26 Feb 2004 17:21 GMT
i think you can make a public function SetStatusBar() in form class module,
write there:

Me.sbrMyStatusBar.Panels(1).Text = screen.activecontrol.StatusBarText

then select all controls could have focus and for GotFocus event write
=SetStatusBar()

Signature

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

> I posted this several days ago in another ng; got no response so I am hoping
> someone here can help me:
[quoted text clipped - 24 lines]
> Thanks in advance,
> lj
lj - 26 Feb 2004 23:56 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.