Hi Ken,
A little vague on the post, but I'm going to assume you
are using the built-in Access Switchboard Manager and you
wish to open a query from the Switchboard. However, the
wizard does not have an option to open queries. Are these
assumptions correct?
If so, you have two options (at least) available to you.
1. You could design your own "Switchboard-type" unbound
form and launch all your procedures from there. I'm sure
most, if not all, of the experts choose this way. They
usually stay away from the Switchboard Manager. Personally
I like the Switchboard Manager and have been able to jazz
it up by adding new things.
2. You can change the Switchboard code a little bit to
achieve your desired result. The Switchboard Manager, as
you have already noticed, will not easily let you open a
query. All we have to do is make a slight change to the
code. Follow these instructions on a BACK-UP COPY!!
Open the Switchboard From in Design mode and go to the
code window. Find the area that has this:
' Constants for the commands that can be executed.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
Add one more line to the list like this:
Const conCmdOpenQuery = 9
Now go a little further down the code until you come to
this area:
' Run code.
Case conCmdRunCode
Application.Run rst![Argument]
' Any other command is unrecognized.
Case Else
MsgBox "Unknown option."
In between these two areas we want to add another one for
opening a query. Add in this new code in the middle so it
looks like this:
' Run code.
Case conCmdRunCode
Application.Run rst![Argument]
' Open Query
Case conCmdOpenQuery
DoCmd.OpenQuery rst![Argument]
' Any other command is unrecognized.
Case Else
MsgBox "Unknown option."
Compile and save the form.
Now you will NOT be able to use the Switchboard Wizard to
use this option. The Wizard will only use the 8 pre-
defined options. To open a query from the Switchboard you
will need to go directly to the Switchboard Items TABLE
and add it yourself. If you study the records you will
figure out what is going on. Just use the number 9 in the
Command field of the table and the name of the query in
the Argument field.
Hope that helps,
Jeff Conrad
Bend, Oregon
-----Original Message-----
I am making a switchboard. The switchboard will not give
an option to add a query.