Next Tip    An example of quickly checking a Report Property for all Reports

By Adam Cogan


I found that some of the reports in a customers database were giving error.  I tracked it down to the 'RecordLock' property being set to 'All Records'. I quickly wanted to see what other reports also had that setting, but there were more than 200 reports in the database. You can use this function to check any other report property.

Function CheckReportProperties(strProperty As String) As String

  ' Comments   : gets all the names of reports in the current database
  ' Parameters : strIn - string to populate
  '               chrDelimit - character to use as a delimiter
  ' Returns    : number of reports

On Error GoTo PROC_ERR

Dim dbsCurrent As Database
Dim conTmp As Container

Set dbsCurrent = CurrentDb()
Set conTmp = dbsCurrent.Containers("reports")

Dim intCount As Integer
Dim docTmp As Document
'Dim strName As String
Dim strIn As String
Dim chrDelimit As String
Dim bolNeedsClosing As Boolean
Dim rptTmp As Report
Dim strName As String

intCount = conTmp.Documents.Count

For Each docTmp In conTmp.Documents
    strName = docTmp.Name
    'check for properties here
    'if the report is closed then open it in design view

    If SysCmd(acSysCmdGetObjectState, acReport, strName) <> acObjStateOpen
Then
        DoCmd.OpenReport strName, acDesign
        bolNeedsClosing = True
    End If

    Set rptTmp = Reports(strName)
    strIn = strIn & vbCrLf & strName & "   -    " & rptTmp.Properties(strProperty).Name & "   -    " &
rptTmp.Properties(strProperty).Value
    'close any open reports
    If bolNeedsClosing Then DoCmd.Close acReport, strName

Next docTmp

CheckReportProperties = strIn

PROC_EXIT:
  Exit Function
PROC_ERR:
  CheckReportProperties = 0
  Resume PROC_EXIT
End Function
 

As an example open Northwind.mdb and the hit Ctl+G for the Debug window.
Then type this.....

? CheckReportProperties("RecordLocks")

Alphabetical List of Products   

   RecordLocks   

Catalog   

   RecordLocks   

Customer Labels   

   RecordLocks   

Employee Sales by Country   

   RecordLocks   

Invoice   

   RecordLocks   

Products by Category   

   RecordLocks   

Sales by Category   

   RecordLocks   

Sales by Category Subreport   

   RecordLocks   

Sales by Year   

   RecordLocks   

Sales by Year Subreport   

   RecordLocks   

Sales Totals by Amount   

   RecordLocks   

Summary of Sales by Quarter   

   RecordLocks   

Summary of Sales by Year   

   RecordLocks   


This message comes to you courtesy of SSW who can be found at http://www.ssw.com.au

Published  1999-07

 

Our Tools and Resources

  • RSS & Newsletter Here
    Join our newsfeed or sign up for our informative newsletter on Office Automation, Access and VB topics
  • Get Good Help
    If you need help with a database, our Australian Professionals could be the answer

  • Smart Access is online 
    The best magazine written about Microsoft Access is now being transferred to the web. There are 400 articles written by a 100 authors in the collection. 

    Purchase Smart Access

  • The Workbench
    Find out who has your database open, start the correct version of Access, easy compacting and backups, change startup options, creation versions,  shutdown database

  • Read about the Toolbox
    Sample downloads, library resource kit and searchable help file comprising most of the information at vb123.com.au plus hidden downloads etc. Includes one of Smart Access downloads.

  • Convert Access to SQL Server  
    Upsize to SQL Server 2005 or 2008, easily repeated conversions, highly accurate SQL query  translation and web form conversion.
  • Purchase the Popular FMS Products  
    If you purchase the Popular FMS products from us, you will receive a complimentary of Smart Access Gold, Silver or Bronze Collections [Your choice]

 

 

vb123 Professionals


Get Good Help Here

If you need help with a database or Office programming, our Professionals could be the answer because we have worked on many similar solutions



Frontpage Conversions
We have converted vb123.com to Expression Web, contact us if we can help you move to the latest Microsoft web tool.


About The Editor ~ Contact Us
Garry Robinson writes for a number of popular computer magazines, is now a book author and has worked on 100+ Access databases. He is based in Sydney, Australia

Access 2003 Security

MS Access Security

Read More here