Link to home
Start Free TrialLog in
Avatar of Peborgh
PeborghFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Hiding and activating a home-made ribbon in Access 2007 VBA

I have been struggling for some time with this. I have a ribbon defined for my app and it appears and works ok.

However, I want to show it when certain fields are entered and hide it when those field is exited.

In my investigations, I have found two ways to do this sort of thing:

DoCmd.ShowToolbar "ribbon", acToolbarYes  ' or acToolbarNo

This appears to grey out the ribbon but does not hide it altogether.

Also:

SendKeys "^{F1}", True      ' yes, I know it is naughty...

This does show the ribbon entirely but does not hide it but greys it out on alternate calls. Or something.

SO, can someone explain to me in words even I can understand what those two pieces of code do,
how I can achieve reliable show/hide of my ribbon
or perhaps suggest alternative ways of doing this with yet another piece of code.

Eternal gratitude.
Avatar of Jez Walters
Jez Walters
Flag of United Kingdom of Great Britain and Northern Ireland image

... yeah that does the trick for me - see the attached sample database!  :-)
Q26990828.mdb
In case you're still wondering, sending the key strokes "Ctrl-F1" repeatedly in Access just minimises and then unminimises the ribbon.

Hope that helps!  :-)
Bear in mind that the sample database I posted above still leaves you with the Office Button and the Quick Access Toolbar - is this what you want?
If you don't want the Office Button/Quick Access Toolbar, your original idea of using the DoCmd.ShowToolbar method will achieve this:
Q26990828.mdb
Avatar of Peborgh

ASKER

Thanx all, I won't be able to try all this out until Friday. I'll let you know what transpires soon after that...

peter
Avatar of Peborgh

ASKER

Sorry to waste time. Somehow and suddenly (!) it all works using the "showtoolbars".

"No country for old men".

peter
Hi Peter,

That's the same conclusion I came to in ID 35511937 above ... sometImes it really is worth just turning it off and on again!  ;-)

Please do bear in mind my comments regarding showing the Office Button/Quick Access Toolbar though!

Jez
Avatar of Peborgh

ASKER

Jez. I intend to look into that on Wednesday.

Can you tell me what those two items look like on the screen. Just to be sure I don't want them...

Many thanks,

peter
ASKER CERTIFIED SOLUTION
Avatar of Jez Walters
Jez Walters
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peborgh

ASKER

Jez, as a result of our eperimenting a couple of weeks' ago, It is all working now, with just one glitch that can be addresed later. many thanks. I will mark one of your contributions as solution because I can't use a face-to-face meeting for that!

Thanks,

peter