Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does the ribbon not appear until I click on a field?

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
I have a main form (acts as a portal into the system), a form from which the user can edit/maintain their data, a form from which the user can select and filter reports, and a several forms that allow the user to maintain look-up tables.

When I open the main form, the custom ribbon I have created for that form is displayed. However, when I open any other form, the ribbon assigned to that form is not shown until I click on a field on that form. I have tried setting focus to a field on the form (followed by DoEvents), but no luck.

The code for handling the ribbons is the same for all of my forms (including the main). Is there something else I need to do for the ribbon to appear without having to click on a field?
 
I discovered how to make it work. On the Activate event of the form I invalidate the ribbon, doevents, and then set the active tab.
 
For clarity and others looking, can you post your code? I for one am not sure what you mean by invalidate the ribbon... Possibly because I have not had to do a whole lot with them.
 
I'm not sure if I'm doing this correctly. It's been several years since I messed with it in Access 2007. I have a situation where, from the main form, the user is allowed to open a LookUp form via an item located on the ribbon. Because the LookUp form was loaded from the ribbon, the main form is hidden while the lookup form is shown. When the LookUp form is opened, the OnRibbonLoad event is launched. In the OnRibbonLoad event I store the ribbon in a public variable (myRibbon). I then issue the command myRibbon.iRibbon.Invalidate followed by myRibbon.iRibbon.ActivateTab "tabIwant".

If I remember correctly, I have to invalidate the ribbon in order to refresh it.

Prior to closing, the LookUp form unhides the main form. The onActivate event of the main form issues the same command: myRibbon.iRibbon.Invalidate followed by myRibbon.iRibbon.ActivateTab "tabIwant".

Note that I have a collection of ribbons assigned to a public variable (allRibbons). So, myRibbon is set equal to the allRibbons("nameOfribbon") in the OnRibbonLoad event and the onActivate event.
 
I see... the only things I have done with the ribbon are to make a custom one that loads instead of the standard with the XML tags...

Somehow I missed the ribbon supports event code. Something to have a look at sometime anyways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top