Database documenter & Conditional Formatting

matt beamish

Registered User.
Local time
Today, 15:17
Joined
Sep 21, 2000
Messages
215
I have a form where Conditional Formatting has been used. I want to run a routine to show me on which Controls the Conditional Formatting has been used, and what expressions were used in the Formatting. Having Run Database Documenter, I was hoping to identify all the Conditional Formatting used so I could tidy it up, but it doesn't look to have been included.
Any ideas on how to Report Conditional Formatting?

Access 2010

thanks
 
Here is a routine that will get the process started. It will review all forms and their controls and identify those with Conditional Formatting. I haven't looked into identifying the rules and details of those Conditional Formats.

Code:
'---------------------------------------------------------------------------------------
' Procedure : CheckForConditionalFormat
' Author    : mellon
' Date      : 04/02/2016
' Purpose   : This routine will iterate over AllForms and identify those Forms and Control(s) 
'  that have Conditional Formatting and list the info to the immediate window.
'---------------------------------------------------------------------------------------
'
Sub CheckForConditionalFormat()
    Dim objAccObj As AccessObject
    Dim objForm As Object
    Dim strForm As String
    Dim ctl As Control
    Dim objActiveForm As Form
    Dim DB As DAO.Database
    
10       On Error GoTo CheckForConditionalFormat_Error

20    Set DB = CurrentDb

30    Set objForm = Application.CurrentProject
40    For Each objAccObj In objForm.AllForms


50      strForm = objAccObj.name

60      DoCmd.OpenForm strForm, acDesign
70      Set objActiveForm = Application.Screen.ActiveForm
80      For Each ctl In objActiveForm.Controls
90          If (ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox) Then
100             If ctl.FormatConditions.Count > 0 Then
110                 Debug.Print strForm & "    " & ctl.name & "          has ConditionalFormat"
120             End If
130         End If
140     Next ctl
150     DoCmd.Close acForm, strForm
160   Next objAccObj

200      On Error GoTo 0
210      Exit Sub

CheckForConditionalFormat_Error:

220       MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CheckForConditionalFormat of Module ModuleTesting_CanKill"

End Sub

Good luck.
 
Last edited:
You're a star - appreciated, thanks - this is most of the work done.
Kudos!
 

Users who are viewing this thread

Back
Top Bottom