If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Albert D Kallal's Ribbon Code
I have succeeded in using Albert D Kallal's brilliant code to control a
Ribbon on a form. The only problem I cannot solve is how to make some buttons invisible when the form loads. If I put the meRib("btSearch").visible = False in Form_Active or Form_Current, I get the runtime error '2475' - you entered an expression that requires a form to be the active window. Any suggestions would be great. -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Albert D Kallal's Ribbon Code
In a nutsheell, that code is written to reduce what you need to supply
and the code assumes the current form has the focus. However, the form is not techniclally loaded untill AFTER the on-load event. My code assumes the current active form to do it's magic. So, in place of meRib, use meRibA meRibA("name of ribbon","name of contorl") you could also pick up the name of the current ribbon as: meRibA(me.Ribbon,"name of contorl") or even use me.Name, as we useally name the ribbon same as the form name. The issue/problem is likely that the on-current code runs before the ribbon code. My best "spider sense" suggestion without going deep into this would be that as a 2nd choice if above can't work is to create a form level var like: dim bolOnLoadDone as boolean Then, in your on-current code if bolLoadDone then ' code here to do the visible dance... meRib("btSearch").visible = False end if And, in your on-load, you set the bolOnLoadDone = true AFTER every thing else... And, you might have to thus call the the visible code from the on-load also. So, try the meRibA and simply supply the ribbon name. if that don't work, then you have to use the bol flag as per above. The meRib code assumes the ACTIVE form and the form does NOT become active until AFTER on-load is done and exit. My code uses screen.ActiveForm, and that means meRib can't be used in the on-load event. However: meRibA should work, but if not, then I think the above flag is the next road + suggestion... -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada |
Thread Tools | |
Display Modes | |
|
|