<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0cm;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman";}
h2
{margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
font-size:14.0pt;
font-family:Arial;
font-style:italic;}
h3
{margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
font-size:13.0pt;
font-family:Arial;}
h4
{margin-top:3.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
font-size:12.0pt;
font-family:Arial;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p.Code, li.Code, div.Code
{margin-top:6.0pt;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:17.85pt;
punctuation-wrap:simple;
text-autospace:none;
font-size:12.0pt;
font-family:"Courier New";}
p.code0, li.code0, div.code0
{margin-top:6.0pt;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:17.85pt;
punctuation-wrap:simple;
font-size:12.0pt;
font-family:"Courier New";}
p.code00, li.code00, div.code00
{margin-top:6.0pt;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:17.85pt;
punctuation-wrap:simple;
font-size:12.0pt;
font-family:"Courier New";}
span.emailstyle18
{font-family:Arial;
color:windowtext;}
span.emailstyle20
{font-family:Arial;
color:navy;}
span.EmailStyle22
{font-family:Arial;
color:navy;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body bgcolor=silver lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I have a lot of other things on my mind
today, and clearly I am now dazed and confused, and no doubt overlooking
something very obvious. Here is the current code:</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><code></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Public Sub ListDataSources()</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> On Error Resume Next</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Dim strOutFile As
String</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Dim fs As Object</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Dim a As Object</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Dim frm As Form</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Dim ctl As Control</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Dim objFrm As Object</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> strOutFile =
"c:\RecordSources.txt"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Set fs = CreateObject("Scripting.FileSystemObject")</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Set a = fs.CreateTextFile(strOutFile,
True)</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Application.Echo False</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> For Each objFrm In CurrentProject.AllForms</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
DoCmd.OpenForm objFrm.name, acDesign</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Set frm = Forms(objFrm.name)</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
If frm.RecordSource <> "" Then</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Debug.Print objFrm.name & ": " & frm.RecordSource</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "Form: " & objFrm.name</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "==========================================="</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "RecordSource:"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline frm.RecordSource</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "Data Driven Controls"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "--------------------"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
For Each ctl In frm.Controls</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Select Case ctl.Properties("ControlType")
'.ControlType</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Case acComboBox
'111</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Debug.Print ctl.name & ": Combo Box"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Debug.Print ctl.RowSource</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "Control: " & ctl.name</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "RowSource:"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline ctl.RowSource</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Case acListBox
'110</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Debug.Print
ctl.name & ": List Box"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Debug.Print ctl.RowSource</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "Control: " & ctl.name</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline "RowSource:"</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline ctl.RowSource</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Case Else</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
'do nothing</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
'Debug.Print "Ignoring " & ctl.name</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
End Select</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
a.writeline</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Next ctl</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
End If</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>
Set frm = Nothing</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> DoCmd.Close
acForm, objFrm.name, acSaveNo</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Next</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> a.Close</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Application.Echo True</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Set frm = Nothing</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Set fs = Nothing</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Set a = Nothing</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> Set ctl = Nothing</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> End Sub</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'></code></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The odd thing is that the debug window
performs exactly as expected, but the text file contains only this:</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Form: Switchboard</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>===========================================</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>RecordSource:</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Select * From
dbo.Switchboard_Items_2002Dec02</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Data Driven Controls</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>--------------------</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I can’t see why the debug.print
statements dump what I want but the a.writeline statement don’t.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Arthur</span></font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b>
accessd-admin@databaseadvisors.com [mailto:accessd-admin@databaseadvisors.com] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Shamil Salakhetdinov<br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>March 9, 2003</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>1:07 PM</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> accessd@databaseadvisors.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [AccessD] Iterating
Controls</span></font></p>
<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>> <font color=navy><span style='color:navy'>But I’m
not sure what.</span></font></span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Arthur,</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>You open a form but don't assign an object variable
referring to this open form instance - something like that should work:</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>dim efrm as AccessObject</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>dim frm as Access.Form</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>...</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>for each efrm in CurrentProject.AllForms</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>...</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'>
DoCmd.OpenForm efrm.name, acDesign</span></font></p>
</div>
<p class=MsoNormal style='margin-left:36.0pt'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> set
frm=Forms(efrm.name)</span></font></p>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>... </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>next efrm</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>HTH,</span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;
margin-bottom:.0001pt'><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Shamil</span></font></p>
</div>
<blockquote style='border:none;border-left:solid black 1.5pt;padding:0cm 0cm 0cm 4.0pt;
margin-left:3.75pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'>
<div style='font-color:black'>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:0cm;margin-left:45.0pt;
margin-bottom:.0001pt;background:#E4E4E4'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>
</div>
</blockquote>
</div>
</body>
</html>