How to refer to an object by the tab index

Hi,

I'm trying to crease a function to disable the next 'n' fields in a form if called. The easiest way to go about this seems to be by using the tab index numbers to refer to the 'n'th control. However, I can't find any way of going about this. Or is there an easier way

Please help... thanks



Answer this question

How to refer to an object by the tab index

  • bialguos

    sorry... in access
  • Thomas Horan

    Per our support engineer:

    I think we can enumerate the controls in the form and check the tab index. Thus we can decide whether it should be enabled or not.

    Here is some sample code:

    ===

    Public Sub Foo()

    Dim n As Integer

    n = 1

    Debug.Print Form_Form1.ActiveControl.TabIndex

    l = Form_Form1.ActiveControl.TabIndex

    For Each o In Form_Form1.Controls

    Debug.Print o.Name

    On Error Resume Next

    m = 0

    m = o.TabIndex

    On Error GoTo 0

    If m <> 0 And m - l <= n And m - l > 0 Then

    o.Enabled = False

    End If

    Next o

    End Sub

    ===

    It can give our ISV some suggestion. If he has any question, please feel free let me know. Thanks.

    -brenda (ISV Buddy Team)



  • How to refer to an object by the tab index