You can actually write some code to loop through all reports and insert
lines into an Open event procedure or create one.

Dim rptO As AccessObject, mdl As Module, rptX As Report
Dim lngSLine As Long, lngSCol As Long
Dim lngELine As Long, lngECol As Long
Dim strSearchText As String
Dim strCode As String, lngLine As Long

  ' Looking for existing Open event
  strSearchText = "Report_Open"
  strCode = " < set up code to insert here >"

  For Each rptO In CurrentProject.AllReports
    DoCmd.OpenReport rpt.Name, acViewDesign 
    Set rptX = Reports(rptO.Name)
    Set mdl = rptX.Module
    ' See if Open already exists
    If mdl.Find(strSearchText, lngSLine, lngSCol, lngELine, lngECol) Then
      ' Yes - insert new code
      mdl.InsertLines lngSLine + 1, strCode
    Else
      ' No - create a new one
      lngSLine = mdl.CreateEventProc "Open", "Report"
      ' Insert new code
      mdl.InsertLines lngSLine + 1, strCode
    End If
    ' Close and save
    DoCmd.Close acReport, rptX.Name, acSaveYes
  Next rptO

The above code opens each report in design view and sets a pointer to its
module.  It then searches the module to see if there's an existing Report
Open event procedure.  If not, it creates one.  It then inserts whatever is
in the strCode variable after the first line of the procedure.

Haven't tested the above code - be sure to run it in a backup copy of your
database.

John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Lonnie Johnson
Sent: Thursday, January 05, 2006 6:09 AM
To: [email protected]
Subject: Re: [ms_access] MS Access Reports

You could put code in the On Open event of all 400 reports to write to a
table to count each time it was opened.

Moe Napper <[EMAIL PROTECTED]> wrote:  I have an Access database with 400+
reports. I want to start 
consolidating reports, but I don't know what reports are being used the 
most. Is there something I can do to capture how often a report is 
opened? For a few reports I put a little piece of code in the OnOpen to 
update a table with the report name and the user who opened it, but 
because I have so mane reports I don't want to edit each one to insert 
this piece of code. 

I simply want to know what the most popular reports are in my 
system....Any ideas?







    
---------------------------------
  YAHOO! GROUPS LINKS 

    
    Visit your group "ms_access" on the web.
    
    To unsubscribe from this group, send an email to:
 [EMAIL PROTECTED]
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

    
---------------------------------
  






May God bless you beyond your imagination!
Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Visit me at ==> http://www.prodev.us





 





                        
---------------------------------
Yahoo! Photos
 Ring in the New Year with Photo Calendars. Add photos, events, holidays,
whatever.

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to