Reputation: 5
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?
Upvotes: 0
Views: 133
Reputation: 29421
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"
Upvotes: 3