John W. Colby
jwcolby at colbyconsulting.com
Sat Jul 9 15:50:47 CDT 2005
Sorry, I missed the part about wanting only specific types of controls. Function TestCtlType() Dim ctl As Control ctl.ControlType End Function Place your click on the .ControlType and hit F1. Help on ControlType will come up showing a list fo constants for all control types. You code will now look something like: 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 Select Case ctl.ControlType Case acComboBox, acListBox Debug.Print ctl.Name & ":" & ctl.RowSource Case Else End Select 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 John W. Colby Sent: Saturday, July 09, 2005 4:41 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Walk the controls on a given form 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com