我尝试索引表单中的多个文本框,以通过After Update事件更改Visible属性。在组合框指定要循环的多个文本框之后发生该事件。所有文本框都命名为" V1,V2,V3 ... V110等。)我对VBA和Access相对较新,我将如何编写这个?
答案 0 :(得分:3)
您可以使用以下子
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
被称为
ChangeTextBoxVisibility 3, 90, False'<--| set not visible all textboxes from "V3" to "V90"