简体   繁体   中英

Cycling through textboxes on form in MS Access

I'm trying to index through multiple textboxes in a form to change the Visible Property through an after Update event. The event occurs after a combo box designates a number of textboxes to cycle through. All the textboxes are named "V1, V2, V3...V110, etc.) I'm relatively new to VBA and Access, how would I go about coding this?

you can use the following sub

    Option Explicit

    Sub ChangeTextBoxVisibility(iMin As Long, iMax As Long, visibilityState As Boolean)
        Dim i As Long
        With Me
            For i = iMin To iMax
                .Controls("V" & i).Visible = visibilityState
            Next i
        End With
    End Sub

to be called as

ChangeTextBoxVisibility 3, 90, False'<--| set not visible all textboxes from "V3" to "V90"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM