Re: Seeking code to ID & print all controls having a ValidationRule property set - but no ValidationText



I'll have a go at this in A97. Thx 4 suggestion.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Thu, 16 Feb 2006 00:46:41 +0800, "Allen Browne"
<AllenBrowne@xxxxxxxxxxxxxx> wrote:

Perhaps something like this, if you are using Access 2000 or later:

Function FindRuleText()
Dim accobj As AccessObject
Dim ctl As Control
Dim strDoc As String

For Each accobj In CurrentProject.AllForms
strDoc = accobj.Name
DoCmd.OpenForm strDoc, acDesign, WindowMode:=acHidden
For Each ctl In Forms(strDoc).Controls
If HasProperty(ctl, "ValidationRule") Then
If (ctl.ValidationRule <> vbNullString) And
(ctl.ValidationText = vbNullString) Then
Debug.Print strDoc & "." & ctl.Name
End If
End If
Next
DoCmd.Close acForm, strDoc
Next
End Function
Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant
On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
End Function

.



Relevant Pages

  • RE: Multi Select List Box
    ... Dim varItem As Variant ... Dim strWhere As String ... Dim strDelim As String ... Dim strDoc As String ...
    (microsoft.public.access.forms)
  • Re: Looking For Advice!!
    ... Dim strDoc as String ... DoCmd.OpenQuery "qryTEST", acNormal, acEdit ...
    (microsoft.public.access.modulesdaovba)
  • RE: Multi Select List Box
    ... Dim varItem As Variant ... Dim strWhere As String ... Dim strDelim As String ... Dim strDoc As String ...
    (microsoft.public.access.forms)
  • Re: Default Value Question
    ... Dim accObj As AccessObject ... Dim strDoc As String ... For Each accObj In CurrentProject.AllForms ... Set ctl = Forms.Controls ...
    (microsoft.public.access.formscoding)
  • Scanning all objects.
    ... Dim RO As Recordset 'stores record object info. ... Dim strType As String ... Dim strDoc As String ... Set mdl = Forms.Module ...
    (comp.databases.ms-access)