Jack and Pat
drawbridgej at sympatico.ca
Fri Oct 23 08:02:19 CDT 2009
Tony, I found this from Allen Browne: 2/16/2006 4:10:25 PM Re: accessing controls by tab index You could loop through the form's Controls collection, identify those that have a TaxIndex (Labels don't, for instance), and load an array based on the TabIndex of each one: Function LoopControls(frm As Form) Dim ctl As Control Dim strControl() As String Dim i As Integer Dim iMax As Integer ReDim strControl(0 To frm.Controls.Count - 1) For Each ctl In frm.Controls If HasProperty(ctl, "TabIndex") Then i = ctl.TabIndex strControl(i) = ctl.Name If i > iMax Then iMax = i End If End If Next For i = 0 To iMax Debug.Print i, strControl(i) Next End Function Public Function HasProperty(obj As Object, strPropName As String) As Boolean 'Purpose: Return true if the object has the property. Dim varDummy As Variant On Error Resume Next varDummy = obj.Properties(strPropName) HasProperty = (Err.Number = 0) End Function Looping seems to be in tab order anyway. You might want to examine the TabStop property as well. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tony Septav Sent: Friday, October 23, 2009 7:50 AM To: Access Developers discussion and problem solving Subject: [AccessD] Form Controls Hey All Is there a simply way to loop through the controls on a form based on their tab order? Thanks Tony -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com