By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

Controlling a Toolbar from another Form

P: n/a
I have an MS Access app with multiple forms. One of the forms has a Toolbar
(MsComctlLib.Toolbar) and it works as advertised. I handle the buttons in
the Toolbar1_ButtonClick event.
I would like to be able to control the toolbar from another form.

Forms!frmClipping!Toolbar1.Buttons(2).Clicked = True

does not work. Does anybody have any ideas how to do this?
Gerhard


Nov 4 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Gerhard wrote:
I have an MS Access app with multiple forms. One of the forms has a Toolbar
(MsComctlLib.Toolbar) and it works as advertised. I handle the buttons in
the Toolbar1_ButtonClick event.
I would like to be able to control the toolbar from another form.

Forms!frmClipping!Toolbar1.Buttons(2).Clicked = True

does not work. Does anybody have any ideas how to do this?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm assuming that you want to run the toolbar's Click event. Instead of
trying to manipulate the command button on the toolbar make the event
procedure Public and call the event procedure from the other form:

Call Forms!frmClipping.Toolbar1_ButtonClick()

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRU0MSYechKqOuFEgEQKArACcC7QMg7eAkbsUEbtsISOl9C 7wufEAnAoI
5ypfxNqFkuE9M+sP2Vi0Mq2K
=VBer
-----END PGP SIGNATURE-----
Nov 4 '06 #2

P: n/a
Thanks MG, I see where you are going with this.
There are some remaining problems though. The Toolbar1_ButtonClick event
takes a button as object being passed. I am working on creating that, but I
am having problems.
Once instantiated the key or index property would have to be set on that
button object to indicate which button has been pressed or is being
simulated as being pressed.
Let me see how far I can get with this, the documentation is so so,
Gerhard

"MGFoster" <me@privacy.comwrote in message
news:0%*****************@newsread4.news.pas.earthl ink.net...
Gerhard wrote:
I have an MS Access app with multiple forms. One of the forms has a
Toolbar
(MsComctlLib.Toolbar) and it works as advertised. I handle the buttons
in
the Toolbar1_ButtonClick event.
I would like to be able to control the toolbar from another form.

Forms!frmClipping!Toolbar1.Buttons(2).Clicked = True

does not work. Does anybody have any ideas how to do this?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm assuming that you want to run the toolbar's Click event. Instead of
trying to manipulate the command button on the toolbar make the event
procedure Public and call the event procedure from the other form:

Call Forms!frmClipping.Toolbar1_ButtonClick()

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRU0MSYechKqOuFEgEQKArACcC7QMg7eAkbsUEbtsISOl9C 7wufEAnAoI
5ypfxNqFkuE9M+sP2Vi0Mq2K
=VBer
-----END PGP SIGNATURE-----

Nov 5 '06 #3

P: n/a
Yeah, I am bumping up against limitations, both in COM and in Access, or a
combination of both.

I was able to make the Toolbar1_ButtonClick event public, and it is
callable. But as I said, it wants a toolbar button passed. The code turns
out to be:

Call Form_frmClipping.Toolbar1_ButtonClick(btn)

The problem is the form that the call is being made from doesn't know that
there is a toolbar in the project. I can't create a toolbar button object on
the form that doesn't have a toolbar, I'm trying,
I guess that the toolbar is Private to the form that it sits on. And I
don't know how to make it public.

One solution would be to put a hidden toolbar on the calling form, just so
that I could create a button object, but that just seems so stupid.

If you have any other ideas, or if there is something I am obviously doing
wrong, please tell me. Right now, Gerhard

"Gerhard" <ge****************@inch.comwrote in message
news:Y7t3h.2650$MO6.1029@trndny06...
Thanks MG, I see where you are going with this.
There are some remaining problems though. The Toolbar1_ButtonClick event
takes a button as object being passed. I am working on creating that, but
I
am having problems.
Once instantiated the key or index property would have to be set on that
button object to indicate which button has been pressed or is being
simulated as being pressed.
Let me see how far I can get with this, the documentation is so so,
Gerhard

"MGFoster" <me@privacy.comwrote in message
news:0%*****************@newsread4.news.pas.earthl ink.net...
Gerhard wrote:
I have an MS Access app with multiple forms. One of the forms has a
Toolbar
(MsComctlLib.Toolbar) and it works as advertised. I handle the
buttons
in
the Toolbar1_ButtonClick event.
I would like to be able to control the toolbar from another form.
>
Forms!frmClipping!Toolbar1.Buttons(2).Clicked = True
>
does not work. Does anybody have any ideas how to do this?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm assuming that you want to run the toolbar's Click event. Instead of
trying to manipulate the command button on the toolbar make the event
procedure Public and call the event procedure from the other form:

Call Forms!frmClipping.Toolbar1_ButtonClick()

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRU0MSYechKqOuFEgEQKArACcC7QMg7eAkbsUEbtsISOl9C 7wufEAnAoI
5ypfxNqFkuE9M+sP2Vi0Mq2K
=VBer
-----END PGP SIGNATURE-----


Nov 7 '06 #4

P: n/a
MG,
Ok, as usual it was a stupid thing, and sometimes it's a disadvantage to
know other languages, and to think along different lines. The actual code
turned out to be:

Dim btn as Object
Set btn = Form_frmClipping.Toolbar1.Buttons(x) ' where x is the button
index
Call Form_frmClipping.Toolbar1_ButtonClick(btn)

Thanks for your help, and the fact that the other two lines took so long to
produce is due to the fact that I am out of practice with Access, and the
peculiar circumstance that there is no clear reference to mscomtl.ocx in
Access.
Or at least I don't have one, and don't know how to produce it. (I posted
another message about that today) Same in VB by the way, I checked,
Gerhard

"MGFoster" <me@privacy.comwrote in message
news:0%*****************@newsread4.news.pas.earthl ink.net...
Gerhard wrote:
I have an MS Access app with multiple forms. One of the forms has a
Toolbar
(MsComctlLib.Toolbar) and it works as advertised. I handle the buttons
in
the Toolbar1_ButtonClick event.
I would like to be able to control the toolbar from another form.

Forms!frmClipping!Toolbar1.Buttons(2).Clicked = True

does not work. Does anybody have any ideas how to do this?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm assuming that you want to run the toolbar's Click event. Instead of
trying to manipulate the command button on the toolbar make the event
procedure Public and call the event procedure from the other form:

Call Forms!frmClipping.Toolbar1_ButtonClick()

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRU0MSYechKqOuFEgEQKArACcC7QMg7eAkbsUEbtsISOl9C 7wufEAnAoI
5ypfxNqFkuE9M+sP2Vi0Mq2K
=VBer
-----END PGP SIGNATURE-----

Nov 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.