Switchboard - Run Code

Cosmos75

Registered User.
Local time
Today, 15:50
Joined
Apr 22, 2002
Messages
1,281
I have a switchboard that was created with the Switchboard Manager (Access 97). I noticed that there is an option to run code. I have some marcos that have converted to VBA that I want to run using a button on the switchboard but I can't figure out how to do it? Anybody know how?
:confused:

The reason is that I want to make the database file (.mdb) an MDE file so that now onw can look at the code but macros aren't protected. Hence the reason I converted the macro to VBA code.
 
Create a module with Public Functions, ie


Public Function YourConvertedMacro()

DoCmd.OpenForm "SomeForm", acNormal, "", "", acAdd, acNormal

End Function


and then in the switchboard manager type in

YourConvertedMacro

as the function name

IMO
 
Last edited:
Cos:

I assume you are talking about the following line:

Const conCmdRunCode = 8

your code would go after:

' Run code.
Case conCmdRunCode
Application.Run rst![Argument]

And in the Switchboard table the COMMAND field would be 8.

HTH
 
IMO said:
Create a module with Public Functions, ie


Public Function YourConvertedMacro()

DoCmd.OpenForm "SomeForm", acNormal, "", "", acAdd, acNormal

End Function


and then in the switchboard manager type in

YourConvertedMacro

as the function name

IMO

Does the module have to be named something in particular?
 
No, you can name it what you like

IMO
 
IMO,

Thanks!! It works!!

jfgambit,

Thanks for your reply as well!! I am kinda curious as to how the switchboard works. To me right now it's all magic!
 
You're welcome

IMO

PS Don't forget to delete the converted macros from the modules section, they're not needed once you have put the code in the functions.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom