Results 1 to 31 of 31

Thread: How to loop through all INDIVIDUAL controls on a form especially with control arrays

Threaded View

  1. #31
    New Member
    Join Date
    Jul 2016
    Posts
    9

    Re: How to loop through all INDIVIDUAL controls on a form especially with control arr

    This Sample To loop the individual controls

    Code:
        
        For a = 1 To Me.Controls.Count
            ObjName = Me.Controls(a - 1).Name
            ActiveName = ActiveControl.Name
            ObjIndex = ""
            ActiveIndex = ""
            On Error Resume Next
            ObjIndex = Me.Controls(a - 1).Index
            ActiveIndex = ActiveControl.Index
            On Error GoTo 0
            If ObjIndex <> "" Then
               MsgBox Me.Controls(ObjName)(ObjIndex).Name
               Me.Controls(ObjName)(ObjIndex).Enabled = False
               Else
                   MsgBox Me.Controls(ObjName).Name
                   If TypeName(Me.Controls(objname)) = "CommandButton" Then MsgBox "This Is Command Button"
            End If
    
            'MsgBox Me.Controls(a - 1).Name
        Next a
    Last edited by mhd_jamil; Aug 2nd, 2016 at 11:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width