点击下载此附件
Author: 大石
Date: 2009-12-1
Subject: 《单击 Add 按钮后,除 Save 按钮以外,其他命令按钮全变为不可用》
KeyWords: VBA, Enabled, ControlType etc.
Text:
单击 Add 按钮前
单击 Add 按钮后
代码如下,
Option Compare Database
Option Explicit
Private Sub SubAddSave(frmAny As Form, ctlAny As Control)
Dim ctl As Control
ctlAny.Enabled = True
ctlAny.SetFocus
For Each ctl In frmAny.Controls
If ctl.ControlType = acCommandButton Then
If ctl.Name <> ctlAny.Name Then
ctl.Enabled = False
End If
End If
Next ctl
End Sub
Private Sub cmdAdd_Click()
Call SubAddSave(Me, Me.cmdSave)
End Sub
大家看看就行了,很简单的一段代码,实现小小的一个功能。
|