Ribbon command problem

E

ericb

My project begins with the form "Home Base"

I'm begging to customize the ribbon, here is my code :
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="dbCustomTab" label="Exporter" visible="true">
<group id="dbDossier" label="Dossier">
<button id="Runcmd_HB_InfoPersonnel" label="Généralité"
onAction="cmd_HB_InfoPersonnel"/>
<button id="Runcmd_HB_Consultation" label="Consultation"
onAction="cmd_HB_Consultation"/>
<button id="Runcmd_HB_Evaluation" label="Évaluation"
onAction="cmd_HB_Evaluation"/>
<button id="Runcmd_HB_Produit" label="Produit"
onAction="cmd_HB_Produit"/>
</group>
<group id="dbRapport" label="Rapport">
<button id="Runcmd_HB_CieAssurance" label="Cie Assurance"
onAction="cmd_HB_CieAssurance"/>
<button id="Runcmd_HB_Client" label="Client"
onAction="cmd_HB_Client"/>
<button id="Runcmd_HB_Medecin" label="Médecin"
onAction="cmd_HB_Medecin"/>
<button id="Runcmd_HB_Suggestion" label="Suggestion"
onAction="cmd_HB_Suggestion"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

Each command button triggers a function like this :
Public Function cmd_HB_Consultation() As Long

cmd_menu_selectionne = msg_cmd_Consultation

' Ouvrir le formulaire pour imprimer un dossier
DoCmd.OpenForm "Contenu du dossier", , , , , acDialog

' La fnct sest bien executée
cmd_HB_Consultation = True

End Function

Some of the command buttons open the same form. On the opening of the form
the "On Open" event is triggered. In that procedure, I want to know which
button is activated so I can select the proper SQL string.

To go around this right now I made some kind of a flag system, I test
cnd_menu_selectionne. My problem is that I want to do it properly, the right
way.

I want to address the button in the ribbon, where do I get the string of the
select button in the ribbon ?

Also how to I address its properties and where are they ?
That way I can disable some and enable others and also change its background
color.

Thank you for the help
 
M

Maurice

Each button addresses a ribboncontrol id that's what i used for checking
which button was pressed. Look on www.accessribbon.com for further
explanation.

look in VBA for irribboncontrol object.
hth
 

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