How do I run a query from the switchboard

G

Guest

I built a number of queries that I want o add as a submenu to my switchboard.
I can't figure out how to run a query at all from a switchboard
 
G

Guest

Make a backup copy of your database first!

Click the menu TOOLS - Analyze - Documentor. Select Forms - Switchboard.
Click on Options and select only Code. Run and view in MS Word. Scroll down
until you see something like this. It list the command you can run from the
switchboard.

77 Private Function HandleButtonClick(intBtn As Integer)
78 ' This function is called when a button is clicked.
79 ' intBtn indicates which button was clicked.
80
81 ' Constants for the commands that can be executed.
82 Const conCmdGotoSwitchboard = 1
83 Const conCmdOpenFormAdd = 2
84 Const conCmdOpenFormBrowse = 3
85 Const conCmdOpenReport = 4
86 Const conCmdCustomizeSwitchboard = 5
87 Const conCmdExitApplication = 6
88 Const conCmdRunMacro = 7
89 Const conCmdRunCode = 8
90 Const conCmdOpentableEdit = 9
91 Const conCmdOpenFormView = 10
92 Const conCmdOpenFormData = 11
93
94 ' An error that is special cased.
95 Const conErrDoCmdCancelled = 2501
96
97 Dim dbs As Database
98 Dim rst As Recordset
99
100 On Error GoTo HandleButtonClick_Err

Open the table named Switchboard Items and add to the table. The first two
fields are for the screen number (SwitchboardID) and button number
(ItemNumber). Third field is the label for the button. The number of the
command goes in the Command field and the name of your query in the Argument
field.

Make sure to test all buttons and wait awhile before you toss the backup copy.
 
F

fredg

I built a number of queries that I want o add as a submenu to my switchboard.
I can't figure out how to run a query at all from a switchboard

If you are using the Switchboard created by the bui;t-in Switchboard
Manager, the easiest way is the create either a macro to open the
query, or use code in a Module:

Public Sub RunAQuery()
DoCmd.OpenQuery "QueryName"
End Sub

Then use the Switchboard manager to edit the Switchboard command to
either RunMacro or RunCode. Indicate the macro name or the code Sub
name (RunAQuery).
 

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