[AccessD] Iterating Controls

Jim DeMarco Jdemarco at hshhp.org
Sun Mar 9 11:46:00 CST 2003


Works fine in A97 dimming frm as Form and setting it to Me withing a form module. Could the AllForms collection be returning something other than a Form object?  Try wrapping your For...Next in an If...TypeOf block to see if you can weed out "bad" object references.
 
HTH,
 
Jim DeMarco (what am I doing working on a Sunday?)

-----Original Message-----
From: Arthur Fuller [mailto:artful at rogers.com]
Sent: Sunday, March 09, 2003 10:03 AM
To: AccessD
Subject: [AccessD] Iterating Controls



Here's a little snippet from some code I'm writing:

<code>

    '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

</code>

 

The code errors on the second last line, complaining that "object doesn't support this property or method". What's the right way to reference the collection of controls on a form and then walk the collection? 

I'm still hunting as I write this, so I may post my own reply...

TIA,

Arthur



***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from HealthSource/Hudson Health Plan (HS/HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HS/HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030309/27e6431a/attachment-0001.html>


More information about the AccessD mailing list