Use Code To Insert Code In Multiple Reports

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Wiseley

    #1

    Use Code To Insert Code In Multiple Reports


    I want to insert a procedure call to the report close event of 50 or so
    reports in a database. As each report is opened and then closed by a user, I
    want to log the date this occurrred. I am trying to gauge the usage
    frequency of each report ( to see if certain reports can be removed all
    together).

    Is there a way to have a subroutine that, upon execution, loops though all
    the reports in the database and adds some code to each one? I can figure out
    how to loop through the containers("Rep orts").document s to find each report,
    just don't know how to add code to each report object.






  • MacDermott

    #2
    Re: Use Code To Insert Code In Multiple Reports

    It won't be really easy, but with 50 reports, it might be worthwhile.

    You could start by looking at the entry for InsertText in the Access Help
    file.
    The procedure will be much easier if your reports already have modules.

    HTH
    - Turtle

    "Mike Wiseley" <mike.wiseley@g te.net> wrote in message
    news:_jMhb.2921 $843.1269@nwrdd c03.gnilink.net ...[color=blue]
    >
    > I want to insert a procedure call to the report close event of 50 or so
    > reports in a database. As each report is opened and then closed by a user,[/color]
    I[color=blue]
    > want to log the date this occurrred. I am trying to gauge the usage
    > frequency of each report ( to see if certain reports can be removed all
    > together).
    >
    > Is there a way to have a subroutine that, upon execution, loops though all
    > the reports in the database and adds some code to each one? I can figure[/color]
    out[color=blue]
    > how to loop through the containers("Rep orts").document s to find each[/color]
    report,[color=blue]
    > just don't know how to add code to each report object.
    >
    >
    >
    >
    >
    >[/color]


    Comment

    • PC Datasheet

      #3
      Re: Use Code To Insert Code In Multiple Reports

      Mike,

      You don't have to do both open and close. If a report is opened, it will be
      closed somehow. So usage frequency can be determined from open only.

      One thing you could do ---

      Put this code in a standard module:

      Function MyFunction()
      <Code to log name of the report and date report opened>
      End Function

      Then open each report in design view, open properties, go to the Event tab and
      put this expression on the OnOpen line:

      = MyFunction()

      All your reports then will run that same function when they open recording the
      name of the report and the date it was opened.


      --
      PC Datasheet
      Your Resource For Help With Access, Excel And Word Applications




      "Mike Wiseley" <mike.wiseley@g te.net> wrote in message
      news:_jMhb.2921 $843.1269@nwrdd c03.gnilink.net ...[color=blue]
      >
      > I want to insert a procedure call to the report close event of 50 or so
      > reports in a database. As each report is opened and then closed by a user, I
      > want to log the date this occurrred. I am trying to gauge the usage
      > frequency of each report ( to see if certain reports can be removed all
      > together).
      >
      > Is there a way to have a subroutine that, upon execution, loops though all
      > the reports in the database and adds some code to each one? I can figure out
      > how to loop through the containers("Rep orts").document s to find each report,
      > just don't know how to add code to each report object.
      >
      >
      >
      >
      >
      >[/color]


      Comment

      • Ross Presser

        #4
        Re: Use Code To Insert Code In Multiple Reports

        "Mike Wiseley" <mike.wiseley@g te.net> wrote in
        news:_jMhb.2921 $843.1269@nwrdd c03.gnilink.net :
        [color=blue]
        > I want to insert a procedure call to the report close event of 50 or
        > so reports in a database. As each report is opened and then closed by
        > a user, I want to log the date this occurrred. I am trying to gauge
        > the usage frequency of each report ( to see if certain reports can be
        > removed all together).
        >[/color]

        Far better to log such information to a table than to modify the report.

        Comment

        Working...