定义打开窗体只可查看,按下按钮后,方可编辑
为了防止用户可能因误触键盘,而更改记录,将窗体属性设置为不允许添加、不允许删除、不允许编辑。这样,当用户发现问题时,需要更改就很不方便了。为此设计一个按钮按下按钮可以编辑,是很必要的。程序如下:实例点击下载此附件
Private Sub command13_Click()
If Me![command13].Caption = "编辑" Then
Me.AllowAdditions = True '允许添加
Me.AllowDeletions = True '允许删除
Me.AllowEdits = True '允许编辑
Me![command13].Caption = "检视"
ElseIf Me![command13].Caption = "检视" Then
Me.AllowAdditions = False '不允许添加
Me.AllowDeletions = False '不允许删除
Me.AllowEdits = False '不允许编辑
Me![command13].Caption = "编辑"
End If
End Sub