A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Albert D Kallal's Ribbon Code



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2010, 07:42 PM posted to microsoft.public.access.forms
TonyAntique via AccessMonster.com
external usenet poster
 
Posts: 4
Default 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  
Old June 1st, 2010, 08:17 PM posted to microsoft.public.access.forms
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.