vb123.com.au
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
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