Link to home
Start Free TrialLog in
Avatar of Brian Thor
Brian ThorFlag for United States of America

asked on

How can I call a procedure in an Access form from a control on a ribbon?

I want to be able to call a Sub in an Access form from a control on a ribbon. I have no trouble calling Subs which are in "standard" modules but I can't figure out how to call a sub in a form module. Can this be done? If so, how?

Thank you.
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

On the Ribbon XML where you describe the Control you have something like
onAction="The Name of Your Method"

Open in new window

Take Note that the method should have an argument like this
Public Function NameOfYourImage(ctl As IRibbonControl)
' Your Code
End Function

Open in new window

If you want to see it in action i have an Article on using Images for dynamically populating Controls' PictureData and since i use Ribbon for Navigation you can get the Complete Code on how it works
My Article is : Defeating the device-independent bitmap (.dib) format
Avatar of Brian Thor

ASKER

John, I think maybe I didn't explain myself well. No problems calling procedures which are in a standard module. I cannot call a procedure which is in a form's class module. Does that make more sense?
ASKER CERTIFIED SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
John, thank you. That is exactly what I needed.