清空窗体中各栏位资料
* P- p# U9 g/ TPublic Sub ClearD(frm As Form)
0 K" {5 x$ {5 w9 U* T Dim ctl As Control1 k9 z) K1 W) E. S5 }+ D
For Each ctlControl In frm.Controls5 e9 N* g: ^, V9 K; N7 h3 O' Q
If Typeof ctl is acTextBox Or Typeof ctl is acComboBox Then
* p: l. J: `2 f, N2 P' v ctl = ""
- t, t# ]! M' D, x- P+ w DoEvents
& }. |6 r4 t7 P6 e4 }1 Z+ Q End If
' W5 _: R, ^ A) W0 h Next
0 I' W- j, V5 k, [' Y m2 `6 ~, n End Sub' H1 u8 X9 y. y# K
此程序稍一修改便可达到更多的功能如锁定或解锁各栏位) [ X3 e& W f7 b; j$ n* @/ Z! \
Public Sub LockControls(frm As Form, blnSta As Boolean). l9 y7 T/ i2 z* x; s9 f
Dim ctl As Control
: i" O5 W& x& R0 U For Each ctl In frm.Controls
/ u" P8 |+ A# i3 s If TypeOf ctl Is acTextBox Or TypeOf ctl Is acComboBox Then
+ O, Y4 |9 Q4 L4 _& @' u- w ctl.Enabled = blnSta
& L" c, n2 b. j, s* K' J DoEvents) H7 h, @5 c, Z9 G5 d/ N
End If# y# J- c8 @' J# }7 e0 U
Next6 L$ m: A9 |& k) d* C
End Sub |