Michael R Mattys
michael.mattys at adelphia.net
Sun Mar 9 10:11:01 CST 2003
Arthur,
Before you tell me I'm wrong
I'm probably wrong
I'll look a bit closer
But there are things you can't do in ADO
http://www.trigeminal.com/usenet/usenet025.asp?1033
----- Original Message -----
From: Michael R Mattys
To: accessd at databaseadvisors.com
Sent: Sunday, March 09, 2003 11:11 AM
Subject: Re: [AccessD] Iterating Controls
But Arthur -
You're not using DAO or the properties collection
of controls. There are some things you can't do
with ADO.
Mike Mattys
----- Original Message -----
From: Arthur Fuller
To: accessd at databaseadvisors.com
Sent: Sunday, March 09, 2003 10:48 AM
Subject: RE: [AccessD] Iterating Controls
Swing and a miss! I thought you had a home run there but no. Here's the whole sub, and all it prints is the names of the forms. Here's the entire sub:
<code>
Public Sub ListRowSources()
On Error Resume Next
Dim frm As Object, db As CurrentProject, ctl As Control
Dim strOutFile As String
strOutFile = "RowSources.txt" '"c:\testfile.txt"
Set db = CurrentProject
Dim fs As Object, a As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(strOutFile, True)
Set db = CurrentProject
Application.Echo False
Debug.Print "Analyzing Row Sources"
'Walk through forms
For Each frm In db.AllForms
DoCmd.OpenForm frm.name, acDesign
a.writeline "Form: " & frm.name
'Walk through controls
For Each ctl In frm.Controls
With ctl
Debug.Print ctl.Properties("Name")
Select Case .ControlType
Case acComboBox
Debug.Print ctl.name & ": Combo Box"
Debug.Print ctl.RowSource
a.writeline "Control: " & ctl.name
a.writeline "RowSource"
a.writeline ctl.RowSource
Case acListBox
Debug.Print ctl.name & ": List Box"
Debug.Print ctl.RowSource
a.writeline "Control: " & ctl.name
a.writeline "RowSource"
a.writeline ctl.RowSource
Case Else
'do nothing
End Select
End With
Next ctl
DoCmd.Close acForm, frm.name
Next frm
Application.Echo True
Set frm = Nothing
Set db = Nothing
Set fs = Nothing
Set a = Nothing
End Sub
</code?
All it does is print the form names. Not a single mention of any control on any form. Clearly it's more wrong than On Error. But I'm not sure what.
Arthur
-----Original Message-----
From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] On Behalf Of Michael R Mattys
Sent: March 9, 2003 10:26 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Iterating Controls
Hi Arthur,
You're looking too far to see it up close :)
On Error Resume Next
Mike Mattys
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030309/9a28434f/attachment-0001.html>