View Full Version : Solved: Attach Specific Ribbon to Query objects?

10-05-2010, 06:54 AM
Anyone know a way that I can create a ribbon that shows up whenever a query is open? I've done this with Reports and Forms, but queries have me stumped as there is no "Other" property tab for a query in design, or table view.:dunno

Bob Phillips
10-06-2010, 01:55 AM
If you want to control the visibility of a tab, you need to do it via VBA callbacks. That suggests to me that you need to issue the query from VBA.

10-07-2010, 12:50 PM
Currently the query is issued from the Ribbon callback function HandleQueryAction(VBA module in basRibbonCommands). MSDN says I need to use a getVisible="getVisibleCallback" function. However the example it gives is based on a date. I need to know if the current screen is a datasheet view of a query. Now I can assume that because the HandleQueryAction is called that a query was opened, but that still doesn't hide the tab when the query is closed again.

Bob Phillips
10-08-2010, 04:35 AM
What do you mean by a Datasheet view of a query?

10-08-2010, 10:34 AM
If you run a simple select query, you get a datasheet view. I was hoping that I could restrict the "TabExternalData" to objects that I felt could be exported, query results and reports but not available for forms.

I might just give up on this though as I don't see any way of binding it to anything... unless I created a form... doh. Silly me. I'll just create a form with the query as the recordset and display it in datasheet mode only.

Bob Phillips
10-08-2010, 10:51 AM
How about trapping the worksheet activate event and if it is that sheet, make the tab visible?