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!

Custom Ribbons in Access 2007 Projects 1

Status
Not open for further replies.

batteam

Programmer
Sep 12, 2003
374
US
Can you make custom ribbons in an Access 2007 project? Or, because Projects are SQL table based, this is not possible as you cannot create a table to hold the custom ribbon names?

If you can, is there a good source to show how to do this?

Thanks for any help you can offer.
 
Access 2007 does not support creation of .adp's.

Cogito eggo sum – I think, therefore I am a waffle.
 
OK, after a couple days work and searching internet sites, I have the procedure that works pretty well for customized ribbons in Access 2007 PROJECTS.

What works best is to create a three table column in your SQL database with columns: auto_id (autoNumber), RibbonName (varChar(50), and RibbonXML (varChar(6000). Manually enter your custom ribbon name and custom ribbon XML code into the appropriate columns - I only used on custom ribbon so I only have one record in the table. I named my table dbo.CVC1_RibbonXML.

I then went to my Access project and created a new module with the following code:

Function LoadRibbons()

Dim RS As Recordset
Set RS = CurrentProject.Connection.Execute("Select CVC1_RibbonXML.RibbonName, CVC1_RibbonXML.RibbonXML from cvc1_RibbonXML")
If Not RS.BOF Then
Application.LoadCustomUI RS("RibbonName").Value, RS("RibbonXML").Value
End If

RS.Close
Set RS = Nothing
End Function

I named the module 'RibbonLoader'. I then created an autoExec macro that ran the 'LoadRibbons' function in my module.

Now we're set up but I had to do a couple more things. First, its a good idea to go into Access Options, Advanced and under General, click 'Show add-in user interface errors'. Then click 'OK'. This will show any errors in your XML code when Access tries to load your ribbon.

Also, the first time I attempted to load my new ribbon nothing happened so I again went into Access Options, Current Database, and MANUALLY typed in my ribbon name (from the column in the table) in the little ddl under 'Ribbon and Toolbar Options'. Then click 'OK'. Don't know why I had to do this but after I typed it in manually, it was always there on future loads. However, when I did this same routine on a brand new Access Project created with Access 2007, I did not have to do this manaul ribbon name entry. ??

One more thing I did, don't know if it made any difference. I am using a Project that was originally created in Access 2000. I had custom menu bars in that Project so I deleted them (using Access 2000) before opening and using the Project in Access 2007.

Some sites on the net recommend creating a bound form to the table that holds the custom ribbon information. I found that very helpful in adding and editing my custom ribbon info.

Hope some of this helps someone down the line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top