access 2007 ribbon - disable button on click

G

Guest

Hi everyone,
I use one ribbon for navigation through the different areas of the db, and
the ribbon it is selected in "properties > other > ribbon" of every form
involved.
my question is: how do i disable a button, after i click on it (which means:
when i am currently viewing a form, i would like the button related to it to
turn disabled)?

My current xml code is as follows:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="CallbackOnLoad">
<ribbon startFromScratch="true">
<tabs>
<tab id="naviID" label="promotecDB">
<group id="navi2ID" label="Rubrica">
<button id="RUBCLIENTI" label="Clienti" size="large"getImage
="getMyImage" getEnabled="disableXxx" onAction="openRubClienti"/>
<button id="RUBAGENTI" label="Agenti" size="large" getImage
="getMyImage" getEnabled="disableXxx" onAction="openRubAgenti"/>
<button id="RUBRECAP" label="Recapiti" size="large" getImage
="getMyImage" getEnabled="disableXxx" onAction="openRubRecap"/>
</group>
....

I know i have to set the "CallbakOnLoad" and "disableXxx" related to the
pressed button somehow, and afterwards to invalidate the ribbon in order to
refresh it, but don't know how to do that.
I've been searching in newsgroups for my problem, but all my attempts didn't
produce the expected results.

Could you plase give me some advice on this issue?
Thank you so much for your help!
em.an.
 
A

Albert D. Kallal

getEnabled="disableXxx

You have to make a public function in which it returns true/false.

so,

Public Function disablebt1

disable = gblBt1

end if


then in code, you go:

gblBt1 = false
ribbon refresh command goes here....

Now, if you think about the above, that means for every button you need to
enable/disable you have to write a public function and declare a variable.
that is too much work....

A better solution is my ribbon class system that allows you to go:

MyEnable("ribbonName").Contorls("Name of contorl").Enabled = true/false

You can find my example code here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
Access 2007 ribbon code enable/disable example

I not had the time to document the code..but take a quick look at the sample
form.
 
G

Guest

Albert D. Kallal said:
You have to make a public function in which it returns true/false.

so,

Public Function disablebt1

disable = gblBt1

end if


then in code, you go:

gblBt1 = false
ribbon refresh command goes here....

Now, if you think about the above, that means for every button you need to
enable/disable you have to write a public function and declare a variable.
that is too much work....

A better solution is my ribbon class system that allows you to go:

MyEnable("ribbonName").Contorls("Name of contorl").Enabled = true/false

You can find my example code here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
Access 2007 ribbon code enable/disable example

I not had the time to document the code..but take a quick look at the
sample
form.

I'll definite look at your suggestion.
Thank you so much Albert!
em.an.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top