Welcome to SPN

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

Sign Up Now!

Open Report in External Database

Discussion in 'Information Technology' started by Ian King, Jul 28, 2006.

  1. Ian King

    Ian King
    Expand Collapse
    Guest

    Can anyone help with a bit of code to print reports from an external
    database? The reports are unbound.

    Many thanks

    Ian King
     
  2. Loading...


  3. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    You might try dragging the report from the database window to the desktop.
    That will create a shortcut which will open the report for printing. You can
    also set a reference to the database that has the report you want to open,
    then write a standard module sub to open the report. You can now call that
    sub for the first database. The code is the same as opening a report
    normally, it's just put in a Standard Module:

    Public Sub OpenContractors()
    DoCmd.OpenReport "rptContractors", acPreview
    End Sub

    Then in the calling database, a single line in the click event of a button:

    Sub OpenRpt_Click()
    OpenContractors
    End Sub
    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access


    "Ian King" <ian@databasesolutionsuk.co.uk> wrote in message
    news:goydnREkIupRPVnZRVnygg@bt.com...
    > Can anyone help with a bit of code to print reports from an external
    > database? The reports are unbound.
    >
    > Many thanks
    >
    > Ian King
    >
    >
     
  4. Ian King

    Ian King
    Expand Collapse
    Guest

    Love the add reference solution, - never tried that before. However, I need
    to have references to several databases which have duplicate modules in (too
    late to change). This will presumably throw wobblies if I try to reference
    them all.

    I've just tried experimenting with the application object and
    OpenCurrentDatabase method which seems to work ok - are there any pitfalls
    in using this method when you already have a database open?

    Many thanks

    Ian King


    "Arvin Meyer [MVP]" <a@m.com> wrote in message
    news:%23EIO4TxrGHA.4408@TK2MSFTNGP04.phx.gbl...
    > You might try dragging the report from the database window to the desktop.
    > That will create a shortcut which will open the report for printing. You

    can
    > also set a reference to the database that has the report you want to open,
    > then write a standard module sub to open the report. You can now call that
    > sub for the first database. The code is the same as opening a report
    > normally, it's just put in a Standard Module:
    >
    > Public Sub OpenContractors()
    > DoCmd.OpenReport "rptContractors", acPreview
    > End Sub
    >
    > Then in the calling database, a single line in the click event of a

    button:
    >
    > Sub OpenRpt_Click()
    > OpenContractors
    > End Sub
    > --
    > Arvin Meyer, MCP, MVP
    > Microsoft Access
    > Free Access downloads
    > http://www.datastrat.com
    > http://www.mvps.org/access
    >
    >
    > "Ian King" <ian@databasesolutionsuk.co.uk> wrote in message
    > news:goydnREkIupRPVnZRVnygg@bt.com...
    > > Can anyone help with a bit of code to print reports from an external
    > > database? The reports are unbound.
    > >
    > > Many thanks
    > >
    > > Ian King
    > >
    > >

    >
    >
     
  5. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    Other than possible record-locking violations, there shouldn't be any
    problem. Beware of locking violations though, because accessing and
    application in code doesn't lock in the same way. Make sure that you have
    good error handling that is verbose, so that you will know if there's a
    problem.
    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access

    "Ian King" <ian@databasesolutionsuk.co.uk> wrote in message
    news:24ydnUjs0akHKlnZRVnyiA@bt.com...
    > Love the add reference solution, - never tried that before. However, I
    > need
    > to have references to several databases which have duplicate modules in
    > (too
    > late to change). This will presumably throw wobblies if I try to reference
    > them all.
    >
    > I've just tried experimenting with the application object and
    > OpenCurrentDatabase method which seems to work ok - are there any pitfalls
    > in using this method when you already have a database open?
    >
    > Many thanks
    >
    > Ian King
    >
    >
    > "Arvin Meyer [MVP]" <a@m.com> wrote in message
    > news:%23EIO4TxrGHA.4408@TK2MSFTNGP04.phx.gbl...
    >> You might try dragging the report from the database window to the
    >> desktop.
    >> That will create a shortcut which will open the report for printing. You

    > can
    >> also set a reference to the database that has the report you want to
    >> open,
    >> then write a standard module sub to open the report. You can now call
    >> that
    >> sub for the first database. The code is the same as opening a report
    >> normally, it's just put in a Standard Module:
    >>
    >> Public Sub OpenContractors()
    >> DoCmd.OpenReport "rptContractors", acPreview
    >> End Sub
    >>
    >> Then in the calling database, a single line in the click event of a

    > button:
    >>
    >> Sub OpenRpt_Click()
    >> OpenContractors
    >> End Sub
    >> --
    >> Arvin Meyer, MCP, MVP
    >> Microsoft Access
    >> Free Access downloads
    >> http://www.datastrat.com
    >> http://www.mvps.org/access
    >>
    >>
    >> "Ian King" <ian@databasesolutionsuk.co.uk> wrote in message
    >> news:goydnREkIupRPVnZRVnygg@bt.com...
    >> > Can anyone help with a bit of code to print reports from an external
    >> > database? The reports are unbound.
    >> >
    >> > Many thanks
    >> >
    >> > Ian King
    >> >
    >> >

    >>
    >>

    >
    >
     

Share This Page