Queries on a switchboard?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Keene

    Queries on a switchboard?

    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?
  • fredg

    #2
    Re: Queries on a switchboard?

    On 30 Apr 2004 10:46:20 -0700, Michael Keene wrote:
    [color=blue]
    > 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?[/color]

    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.

    Comment

    • Martha

      #3
      Re: Queries on a switchboard?

      bayview04@hotma il.com (Michael Keene) wrote ...[color=blue]
      > 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?[/color]

      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 HandleButtonCli ck. 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_E ntry"
      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)

      Comment

      • Dean Covey

        #4
        Re: Queries on a switchboard?

        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
        Please feel free to stop by every day to learn all you can about acquiring high value auto loans for your next new vehicle purchase.


        MS-Office Certified:


        "Michael Keene" <bayview04@hotm ail.com> wrote in message
        news:908ecb5a.0 404300946.3a05f eef@posting.goo gle.com...[color=blue]
        > 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?[/color]


        Comment

        • Michael Keene

          #5
          Re: Queries on a switchboard?

          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 <fgutkind@examp le.invalid> wrote in message news:<1v0luvqjn 9yhu.1ovi1k5hts sko.dlg@40tude. net>...[color=blue]
          > On 30 Apr 2004 10:46:20 -0700, Michael Keene wrote:
          >[color=green]
          > > 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?[/color]
          >
          > 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.[/color]

          Comment

          • Salad

            #6
            Re: Queries on a switchboard?

            Michael Keene wrote:
            [color=blue]
            > 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?[/color]

            Yes. Use RunCode. In a module put the code to open/run the query.
            Then call that function in the switchboard.


            Comment

            Working...