Results 1 to 3 of 3

Thread: Is it possible to program a search for the buttons on the surface of the form?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2021
    Posts
    257

    Question Is it possible to program a search for the buttons on the surface of the form?

    hi
    Is it possible to program a search for the buttons on the surface of the form?
    Attached Images Attached Images  

  2. #2
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: Is it possible to program a search for the buttons on the surface of the form?

    Code:
    Private Sub Form_Activate()
        Dim ctrl As Control
        Dim s As String
       
        For Each ctrl In Me.Controls
            With ctrl
                s = s & .Name
                On Error GoTo index_error
                s = s & " (" & .Index & ")"
                GoTo index_ok
    index_error:
                Resume index_ok
    index_ok:
                On Error GoTo 0
                s = s & vbCrLf
            End With
        Next
       
        MsgBox s
    End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2021
    Posts
    257

    Re: Is it possible to program a search for the buttons on the surface of the form?

    Quote Originally Posted by Argus19 View Post
    Code:
    Private Sub Form_Activate()
        Dim ctrl As Control
        Dim s As String
       
        For Each ctrl In Me.Controls
            With ctrl
                s = s & .Name
                On Error GoTo index_error
                s = s & " (" & .Index & ")"
                GoTo index_ok
    index_error:
                Resume index_ok
    index_ok:
                On Error GoTo 0
                s = s & vbCrLf
            End With
        Next
       
        MsgBox s
    End Sub
    ---------------------------------------------------------
    nice thank you

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