|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Using CommandBar to kick off some functions
After chopping up some of the code from http://www.experts-exchange.com/Dat...Q_20838228.html I've made some nice functions to export to and chart in Excel... Now I want to have the users be able to access them easily.
Ideally, I'd like to use the CommandBar stuff to make a floating toolbar that automagically appears for the queries that can use it (that's easy--use the events to change the appropriate property to visible). However, I have 2 needs/problems with this: 1.) How can the CommandBar button know which query or form I'm currently viewing? There must be some value for "currently viewing this ___" that I can pass the function, yes? 2.) One of the buttons can only work on a subset of the those queries/forms, so I'd like to have it "greyed out" (i.e. unclickable, inactive) programmatically... but how? Of, if you have other ideas for making my charting functions easily accessible in the UI for a number of queries, send 'em my way... TIA-- ~ewall |
|
#2
|
|||
|
|||
|
Personally I would create a custom Toolbar/Menu that I would put everything in and have it display when you are displaying queries and reports.
They the always display towards the top of the screen, just like the other toolbars. S- |
|
#3
|
||||
|
||||
|
...but how?
That's just it--I've created the custom toolbar, but I don't know how to tell it what query I'm currently viewing to feed the function (e.g. =CreateChart("<query name>") ).
Furthermore, I can't seem to find any events attached to opening a query or form wherewith I could set the toolbar to 'visible' and maybe set a variable it could use in the function (e.g. =CreateChart( strCurrentQuery) ). ~ewall |
|
#4
|
|||
|
|||
|
Where you enter the code to display the query (on your form) include the following code
DoCmd.ShowToolbar "CustomqueryToolBar", acToolbarYes or DoCmd.ShowToolbar "CustomqueryToolBar", acToolbarNo S- |
|
#5
|
||||
|
||||
|
Great! So I need to make every query into a form for that, I assume... No problem.
To more easily solve the problem of some queries not being able to use all the buttons, I just made multiple custom toolbars. For passing the parameter of the query name to the function, I have the launching event set a public variable. I think that'll work for everything--Thanks! ~ewall |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Using CommandBar to kick off some functions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|