473,657 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

MLH
Seeking code to ID & print all controls on all forms having a
ValidationRule property set - but no ValidationText property
setting. Perhaps some modification of the following procedure
would do it?

Private Sub ListControlsBtt n_Click()
'************** *************** *************** *************** **************
' Purpose: Run the Controls Collection for user-specified form.
' The controls collection is a form's default collection.
'************** *************** *************** *************** **************
On Error GoTo ListControlsBtt n_ClickError
Dim ThisForm As String
ThisForm = Me.Name
Dim i As Integer, intHowmany As Integer, WhichForm As String

Msg = "Enter form name." ' Set prompt.
Title = "Form Name?" ' Set title.
Defvalue = "frmListThi ngs" ' Set default return value.
WhichForm = InputBox$(Msg, Title, Defvalue) ' Get user input.
If WhichForm = "" Then Exit Sub
For i = 0 To Forms(WhichForm ).Count - 1
intHowmany = intHowmany + 1
Debug.Print intHowmany; ") "; Forms(WhichForm )(i).Name
Next i

ExitButton11_Cl ick:
Exit Sub

ListControlsBtt n_ClickError:
Dim r As String, k As String, Message3 As String
r = "The following unexpected error occurred in Sub
ListControlsBtt n_Click, CBF on " & ThisForm & "."
k = CRLF & CRLF & "Error # " & Trim$(str$(Err) ) & ": " & Quote &
Error$ & Quote
Message3 = r & k
MsgBox Message3, vbExclamation, "Unexpected Error - " & MyApp$ &
", rev. " & MY_VERSION$
Resume ExitButton11_Cl ick

End Sub

Feb 15 '06 #1
4 1436
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:=acH idden
For Each ctl In Forms(strDoc).C ontrols
If HasProperty(ctl , "ValidationRule ") Then
If (ctl.Validation Rule <> vbNullString) And
(ctl.Validation Text = 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

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthStat e.net> wrote in message
news:hk******** *************** *********@4ax.c om...
Seeking code to ID & print all controls on all forms having a
ValidationRule property set - but no ValidationText property
setting. Perhaps some modification of the following procedure
would do it?

Feb 15 '06 #2
You have the patience of Job, Allen.

Feb 15 '06 #3
MLH
I'll have a go at this in A97. Thx 4 suggestion.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx

On Thu, 16 Feb 2006 00:46:41 +0800, "Allen Browne"
<Al*********@Se eSig.Invalid> 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:=acH idden
For Each ctl In Forms(strDoc).C ontrols
If HasProperty(ctl , "ValidationRule ") Then
If (ctl.Validation Rule <> vbNullString) And
(ctl.Validatio nText = 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


Feb 16 '06 #4
A97 does not have the AllForms collection.

To loop through the names of the forms, OpenRecordset on:
SELECT [Name] FROM MsysObjects
WHERE (([Type] = -32768) AND ([Name] Not Like '~*'))
ORDER BY MsysObjects.Nam e;

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthStat e.net> wrote in message
news:5a******** *************** *********@4ax.c om...
I'll have a go at this in A97. Thx 4 suggestion.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxx

On Thu, 16 Feb 2006 00:46:41 +0800, "Allen Browne"
<Al*********@Se eSig.Invalid> 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:=acH idden
For Each ctl In Forms(strDoc).C ontrols
If HasProperty(ctl , "ValidationRule ") Then
If (ctl.Validation Rule <> vbNullString) And
(ctl.Validati onText = 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

Feb 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2892
by: MLH | last post by:
Having identified a A97 bug in which acDialog causes undesirable side effects processing the opened form, I would like to replace the following code running in MyForm ... DoCmd.OpenForm "frmVehicleChooserForm", , , , , acDialog .... (more code I want to run after suspension) With this new approach... DoCmd.OpenForm "frmVehicleChooserForm", , , , , , ThisForm Me.Visible = False
18
18359
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
7
8522
by: Donald Grove | last post by:
Is it possible to retrieve field properties from a table in access2000 using code? I have tried: " dim dbs as dao.database dim tbl as dao.tabledef dim fld as dao.field dim prop as dao.property
3
1361
by: CDMAPoster | last post by:
A.K.A. Is Double Dating a bad thing :-)? My post from several hours ago may have gotten lost so please forgive me if something similar to this shows up twice. From a modular programming class I took many years ago I was taught that it is important to maintain a good interface to hidden code so that when updates are created they can be tested and swapped into place without the program having to know the details of the hidden code. The...
3
1996
by: Ronald S. Cook | last post by:
I'm developing a Windows application that will have an ListBar like in Outlook. When the user clicks on a ListBar item, I would like to load the associated User Control. The below code works fine, but I'm looking for something more dynamic (since we'll have dozens if not hundreds of user listbar items/user controls). private void ulbListBar_ItemSelected(object sender, Infragistics.Win.UltraWinListBar.ItemEventArgs e) {...
1
1450
by: Ajak | last post by:
Hi all, I would like to write a class (Task) with a method to do some lengthy process based on several of the class properties. The method is running on different thread. During the execution of the method, the class is suppose to fire events such as ProgressChanged. And it raises Completed and Failed event on completion and error
8
2169
by: Greg (codepug | last post by:
For lack of the proper expression, how do I excite a control to cause events to trigger. I have a date control and am using a calender form button to fill the text box with the date. The text box is bound to a field. All this works great, but now the date range validation is not not working and the after update event that did calculations is not working. This is without question the result of the control not firing because I'm using...
9
2504
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett -- comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.