By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

Queries on a switchboard?

P: n/a
I have a query that I'd like to add to my switchboard, but when I use
the switchboard manager I only get the option to run a report, a macro
or open a form. Is there a way to add a query without making it a
macro?
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 30 Apr 2004 10:46:20 -0700, Michael Keene wrote:
I have a query that I'd like to add to my switchboard, but when I use
the switchboard manager I only get the option to run a report, a macro
or open a form. Is there a way to add a query without making it a
macro?


You must be using the switchboard generated by the Switchboard
manager.

Yes you can add the Open Query command to the switchboard, but you'll
have to also manually edit the Switchboard Items table, as the
OpenQuery will not be an option in the Manager.
It's much simpler to use a macro (or code) and set the command line to
run the macro (or code).
Create a macro (if that's what you're familiar with) to open the
query.
Edit the switch board and set the command to Run Macro. Then write the
macro name in the Macro Name box.

In code it would be the same, except you are using the Run Code
command. Place the code in Public module.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #2

P: n/a
ba*******@hotmail.com (Michael Keene) wrote ...
I have a query that I'd like to add to my switchboard, but when I use
the switchboard manager I only get the option to run a report, a macro
or open a form. Is there a way to add a query without making it a
macro?


I assume you used the Switchboard Manager to generate the switchboard?
You can add more functionality to the code, but the Switchboard
Manager won't support it--you'll need to add a button with some sort
of dummy functionality, then go directly to the table to change the
command and argument.

To add the ability to run a query, open the code behind the
switchboard form. Find the function called HandleButtonClick. There
are a bunch of constants defined at the beginning; add one for opening
a query, i.e. something like:

Const conCmdRunQuery = 9 'my addition, not supported by wizard

Next, find the end of the Select Case statement and insert a new Case
(*before* the Case Else).

' Run a query (my addition, can't use with wizard)
Case conCmdRunQuery
If IsNull(rst![Argument]) Then
On Error Resume Next
Application.Run "wzmain80.ssq_Entry"
On Error GoTo 0
Else
DoCmd.OpenQuery rst![Argument]
End If

The IsNull stuff is so that if you leave the argument blank, the Query
Wizard will come up.

As far as I recall, that's all that needs to be changed. To run a
query with a particular button, go to its row in the switchboard
table, type the query name in the Argument column, and put your new
constant (9 in my example) in the Command column.

--
HTH,
Martha
(don't google to email)
Nov 12 '05 #3

P: n/a
Why not create a form on the query and open that. Another simple way is to
create a macro (or code) to open the query then tell the switchboard to run
that. I have done this where the user wanted the query to open in design
view so they could enter parameters.

--
Dean Covey
www.coveyaccounting.com

MS-Office Certified:
http://www.microsoft.com/learning/mc...st/default.asp

"Michael Keene" <ba*******@hotmail.com> wrote in message
news:90**************************@posting.google.c om...
I have a query that I'd like to add to my switchboard, but when I use
the switchboard manager I only get the option to run a report, a macro
or open a form. Is there a way to add a query without making it a
macro?

Nov 12 '05 #4

P: n/a
I made my query into a macro and assigned that through the switchboard
and my query can now be run from the switchboard, thanks. I'm
EXTREMELY new to coding so that wasn't a viable option, hopefully
soon.

Thanks again.

fredg <fg******@example.invalid> wrote in message news:<1v*****************************@40tude.net>. ..
On 30 Apr 2004 10:46:20 -0700, Michael Keene wrote:
I have a query that I'd like to add to my switchboard, but when I use
the switchboard manager I only get the option to run a report, a macro
or open a form. Is there a way to add a query without making it a
macro?


You must be using the switchboard generated by the Switchboard
manager.

Yes you can add the Open Query command to the switchboard, but you'll
have to also manually edit the Switchboard Items table, as the
OpenQuery will not be an option in the Manager.
It's much simpler to use a macro (or code) and set the command line to
run the macro (or code).
Create a macro (if that's what you're familiar with) to open the
query.
Edit the switch board and set the command to Run Macro. Then write the
macro name in the Macro Name box.

In code it would be the same, except you are using the Run Code
command. Place the code in Public module.

Nov 12 '05 #5

P: n/a
Michael Keene wrote:
I have a query that I'd like to add to my switchboard, but when I use
the switchboard manager I only get the option to run a report, a macro
or open a form. Is there a way to add a query without making it a
macro?


Yes. Use RunCode. In a module put the code to open/run the query.
Then call that function in the switchboard.
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.