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.
PeborghAsked:
Who is Participating?
 
JezWaltersCommented:
You should be able to see exactly how each case looks by trying out the two sample databases I posted ...

If you set an empty ribbon you get "EmptyRibbonWithOfficeButton.jpg" below.
If you disable the ribbon you get "DisabledRibbonWithoutOfficeButto.jpg".
EmptyRibbonWithOfficeButton.jpg
DisabledRibbonWithoutOfficeButto.jpg
0
 
JezWaltersCommented:
0
 
JezWaltersCommented:
... yeah that does the trick for me - see the attached sample database!  :-)
Q26990828.mdb
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
JezWaltersCommented:
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!  :-)
0
 
JezWaltersCommented:
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?
0
 
JezWaltersCommented:
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
0
 
PeborghAuthor Commented:
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
0
 
PeborghAuthor Commented:
Sorry to waste time. Somehow and suddenly (!) it all works using the "showtoolbars".

"No country for old men".

peter
0
 
JezWaltersCommented:
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
0
 
PeborghAuthor Commented:
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
0
 
PeborghAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.