清空窗体中各栏位资料, S* [$ _6 K( J& ]
Public Sub ClearD(frm As Form)
" o6 O y- f/ D0 [3 f& U" r2 y4 E Dim ctl As Control' c0 r4 F. o9 T! ]) ^: n5 @
For Each ctlControl In frm.Controls7 Y {) `& c( U! ~/ {
If Typeof ctl is acTextBox Or Typeof ctl is acComboBox Then
8 e! K: n) s4 q3 } y0 [5 n6 j ctl = ""$ x, V* F& s7 D' p( I! m4 b# H% D
DoEvents
% q. k M y( s1 v9 W- J End If! f5 e h& v+ n1 M+ y4 \
Next
" }/ n: B. g8 @0 j End Sub# N C( o* m% D
此程序稍一修改便可达到更多的功能如锁定或解锁各栏位
9 A& C/ U' k) b" f2 K0 W+ Q$ u. E! o Public Sub LockControls(frm As Form, blnSta As Boolean)4 `3 ]9 x, A2 q# J8 S
Dim ctl As Control! x/ {2 ]7 }; o7 a
For Each ctl In frm.Controls
7 J4 j& \( E1 `: i If TypeOf ctl Is acTextBox Or TypeOf ctl Is acComboBox Then# y/ d: b; m0 t5 @
ctl.Enabled = blnSta% c1 f2 [& T* i o: l4 A
DoEvents" H( Y8 g1 O7 g2 L, o4 g
End If3 h- X# {9 A4 [" |) ?8 B0 M3 R
Next5 u% [# t6 ^/ w O8 ]
End Sub |