Link to home
Start Free TrialLog in
Avatar of Paul McCabe
Paul McCabe

asked on

MS Access Hotkeys: Calling a function from a macro

Hello Experts,

I am using Access 2013 / Windows 7 64-bit.
I have a function in a standard module that closes all open forms except for the main navigation form. It works perfectly when placed behind a command button, so the code is fine. It is pretty useful, but would be even more so if I could run it by pressing a function key on the keyboard (F1, F2 etc).
To this end, I have created a macro called "Autokeys"; this contains a submacro called {F3}, and I am trying to call the form closing function from this but it is not working for me.
The name of the standard module is S_CloseAllForms, and the name of the function within this is Public Function CloseAllForms(). I have tried to call the function from the AutoKeys macro using "execute procedure", "execute macro", "execute application" and "execute data macro" options, naming the function "S_CloseAllForms.CloseAllForms" and various variations thereof. Depending on the combination I get either no response or error messages mostly saying that the function cannot be found. I would be most grateful if anyone could point me in the right direction.
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

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
Avatar of Paul McCabe
Paul McCabe

ASKER

Actually, I am using a Japanese system, and "Run procedure" was my literal translation for "RunCode". But your comment helped me focus on "RunCode" and I finally figured it out; I just needed the function name with the parentheses following. So in the Autokeys macro, I should have just named the function as "CloseAllForms()". Although I had already read that article before, I overlooked it as it is embedded in a rather technical explanation. Amazing how much frustration something small like a pair of parentheses can cause. Thank you for being the catalyst that got me there !