[AccessD] Walk the controls on a given form

John W. Colby jwcolby at colbyconsulting.com
Sat Jul 9 15:40:43 CDT 2005


Sub DumpRowSources ( f as Form )
Dim ctl as control
   'assume the form has already been opened by the calling process
   'I want to walk the controls
   'the only controls of interest are combos or listboxes so I can skip 
   'over all others
   Debug.print f.name
   For Each ctl in f.Controls     '<--- this is the important part
      If the control is either a listbox or combo-box
         Debug.print ctl.Name & ":" & ctl.RowSource
      End If
   Next
End Sub


John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Saturday, July 09, 2005 3:46 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Walk the controls on a given form


I think I have asked this previously, but if I received an answer then I
misplaced it. Here is exactly what I need.... This is pseudo-code. Don't
expect it to compile!

Sub DumpRowSources ( f as Form )
   'assume the form has already been opened by the calling process
   'I want to walk the controls
   'the only controls of interest are combos or listboxes so I can skip 
   'over all others
   Debug.print f.name
   For Each ctl in f.ControlsCollection     '<--- this is the important part
      If the control is either a listbox or combo-box
         Debug.print ctl.Name & ":"
         Debug.print ctl.RowSource
      End If
   Next
End Sub

TIA!
Arthur

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






More information about the AccessD mailing list