Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Help. Need simple switchboard button to run multiple reports

Discussion in 'Information Technology' started by BruceNorris@budweiser.com, Jul 28, 2006.

  1. BruceNorris@budweiser.com

    BruceNorris@budweiser.com
    Expand Collapse
    Guest

    Access 2002

    I'm an Excel coder and have inherited an Access db. It has a
    switchboard with buttons that successfully print single reports. I now
    want to create one button that prints all those reports with just one
    click. Is that possible? With the switchboard manager, I added a button
    and set the command as OpenReport, but it seemed I could enter only one
    report name, am I seeing that correctly?

    Assuming that's correct, I guessed I have to write a macro and have the
    button run that code, is that right? If so, should I set the
    switchboard button to RunMacro or RunCode? What's the difference? And
    where should I write the code in a new module, enter it as a macro, or
    write it in with the switchboard code? -confused.

    I thought the code would be simple like this, right?

    Sub RunBfrRpts()
    DoCmd.OpenReport "rpt001", acViewNormal
    DoCmd.OpenReport "rpt002", acViewNormal
    DoCmd.OpenReport "rpt003", acViewNormal
    End Sub

    Anyway, could someone point me in the right direction?

    Thanks,
    Bruce
     
  2. Loading...

    Similar Threads Forum Date
    Interracial And Interfaith Marriage, Help Needed To Confront/convince My Parents Love & Marriage Aug 16, 2016
    17 yr old Baljit needs your help Get Involved Aug 19, 2015
    Learn Punjabi Need help Language, Arts & Culture May 20, 2014
    United Sikhs From United Sikhs. Phillippines Needs Your Help Sikh Organisations Nov 22, 2013
    Need Help... (Keeping Hair) Questions and Answers Sep 2, 2013

  3. fredg

    fredg
    Expand Collapse
    Guest

    On 6 Jun 2006 16:36:16 -0700, BruceNorris@budweiser.com wrote:

    > Access 2002
    >
    > I'm an Excel coder and have inherited an Access db. It has a
    > switchboard with buttons that successfully print single reports. I now
    > want to create one button that prints all those reports with just one
    > click. Is that possible? With the switchboard manager, I added a button
    > and set the command as OpenReport, but it seemed I could enter only one
    > report name, am I seeing that correctly?
    >
    > Assuming that's correct, I guessed I have to write a macro and have the
    > button run that code, is that right? If so, should I set the
    > switchboard button to RunMacro or RunCode? What's the difference? And
    > where should I write the code in a new module, enter it as a macro, or
    > write it in with the switchboard code? -confused.
    >
    > I thought the code would be simple like this, right?
    >
    > Sub RunBfrRpts()
    > DoCmd.OpenReport "rpt001", acViewNormal
    > DoCmd.OpenReport "rpt002", acViewNormal
    > DoCmd.OpenReport "rpt003", acViewNormal
    > End Sub
    >
    > Anyway, could someone point me in the right direction?
    >
    > Thanks,
    > Bruce


    One of the problems with the built in Access switchboard is that it is
    not very adaptable.

    To run several reports at the click of one button, place your above
    RunBfrRpts code in a new MODULE.
    Then, using the switchboard manager to edit the switchboard page, set
    the button to Run Code. Write
    RunBfrRpts
    in the Function Name dialog box.

    Note, since acNormal is the default, there is no need to write it,
    i.e. DoCmd.OpenReport "rpt001" (without ,acNormal) will print without
    previewing.
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail
     
  4. Bruce Norris

    Bruce Norris
    Expand Collapse
    Guest

    fredg wrote:
    > On 6 Jun 2006 16:36:16 -0700, BruceNorris@budw....com wrote:
    >
    > > Access 2002
    > >
    > > I'm an Excel coder and have inherited an Access db. It has a
    > > switchboard with buttons that successfully print single reports. I now
    > > want to create one button that prints all those reports with just one
    > > click. Is that possible? With the switchboard manager, I added a button
    > > and set the command as OpenReport, but it seemed I could enter only one
    > > report name, am I seeing that correctly?
    > >
    > > Assuming that's correct, I guessed I have to write a macro and have the
    > > button run that code, is that right? If so, should I set the
    > > switchboard button to RunMacro or RunCode? What's the difference? And
    > > where should I write the code in a new module, enter it as a macro, or
    > > write it in with the switchboard code? -confused.
    > >
    > > I thought the code would be simple like this, right?
    > >
    > > Sub RunBfrRpts()
    > > DoCmd.OpenReport "rpt001", acViewNormal
    > > DoCmd.OpenReport "rpt002", acViewNormal
    > > DoCmd.OpenReport "rpt003", acViewNormal
    > > End Sub
    > >
    > > Anyway, could someone point me in the right direction?
    > >
    > > Thanks,
    > > Bruce


    > One of the problems with the built in Access switchboard is that it is
    > not very adaptable.
    >
    > To run several reports at the click of one button, place your above
    > RunBfrRpts code in a new MODULE.
    > Then, using the switchboard manager to edit the switchboard page, set
    > the button to Run Code. Write
    > RunBfrRpts
    > in the Function Name dialog box.
    >
    > Note, since acNormal is the default, there is no need to write it,
    > i.e. DoCmd.OpenReport "rpt001" (without ,acNormal) will print without
    > previewing.
    > --
    > Fred


    Thanks, Fred.

    I wrote the code in a new module (Module1) as Sub RunBfrRpts(). In
    switchboard manager, I edited the button to Run Code and entered
    RunBfrRpts. As a test, I wrote the procedure to run just one report,
    but am getting this when I click the switchboard button:
    "There was an error executing the command."

    Do I need to prefix the function call as Module1.RunBfrRpts or anything
    like that?

    If that's not the problem, I suspect I'm writing the module in the
    wrong db file. This system contains many Access db's where the
    switchboard table is in one main db and linked to all the others. So,
    the main db serves as a central controller for the switchboards in all
    the other db's. And the other db's seemingly have been built with main
    being a template of some sort. They contain tables and reports of thier
    own but all built with the same structure as each other. So, I suspect
    the module I built in the main db isn't being read by the db I'm in
    when I operate the switchboard. Does that make sense?

    I tried building the module directly in one of the other db's, but it
    wouldn't let me save it, saying I didn't have exclusive rights. What is
    that?

    Sorry for my ignorance. This is probebly a simple thing, but I'm just
    not very experienced with switchboard. As you probebly know, in Excel
    we program forms from scratch, so I'm not used to working things this
    way. Thanks for your patience.

    What do you think I need to do?

    -Bruce
     
  5. Bruce Norris

    Bruce Norris
    Expand Collapse
    Guest

    Re: Help. Need simple switchboard button to run multiple reports (correction)

    Bruce Norris wrote:
    > fredg wrote:
    > > On 6 Jun 2006 16:36:16 -0700, BruceNorris@budw....com wrote:
    > >
    > > > Access 2002
    > > >
    > > > I'm an Excel coder and have inherited an Access db. It has a
    > > > switchboard with buttons that successfully print single reports. I now
    > > > want to create one button that prints all those reports with just one
    > > > click. Is that possible? With the switchboard manager, I added a button
    > > > and set the command as OpenReport, but it seemed I could enter only one
    > > > report name, am I seeing that correctly?
    > > >
    > > > Assuming that's correct, I guessed I have to write a macro and have the
    > > > button run that code, is that right? If so, should I set the
    > > > switchboard button to RunMacro or RunCode? What's the difference? And
    > > > where should I write the code in a new module, enter it as a macro, or
    > > > write it in with the switchboard code? -confused.
    > > >
    > > > I thought the code would be simple like this, right?
    > > >
    > > > Sub RunBfrRpts()
    > > > DoCmd.OpenReport "rpt001", acViewNormal
    > > > DoCmd.OpenReport "rpt002", acViewNormal
    > > > DoCmd.OpenReport "rpt003", acViewNormal
    > > > End Sub
    > > >
    > > > Anyway, could someone point me in the right direction?
    > > >
    > > > Thanks,
    > > > Bruce

    >
    > > One of the problems with the built in Access switchboard is that it is
    > > not very adaptable.
    > >
    > > To run several reports at the click of one button, place your above
    > > RunBfrRpts code in a new MODULE.
    > > Then, using the switchboard manager to edit the switchboard page, set
    > > the button to Run Code. Write
    > > RunBfrRpts
    > > in the Function Name dialog box.
    > >
    > > Note, since acNormal is the default, there is no need to write it,
    > > i.e. DoCmd.OpenReport "rpt001" (without ,acNormal) will print without
    > > previewing.
    > > --
    > > Fred


    > ...
    > I tried building the module directly in one of the other db's, but it
    > wouldn't let me save it, saying I didn't have exclusive rights. What is
    > that?
    > ...


    Sorry, that should have read exclusive ACCESS, not rights. It said I
    can't save changes because I don't have exclusive access. Does that
    mean someone else has the file open? It is on an intranet, so that's
    possible, but how can I prevent others working in it while I'm tweaking
    it?

    -Bruce
     

Share This Page