设备使用管理 Access数据库功能模块讲解 VBA代码实例
设备管理
Private Sub Form_AfterUpdate()
Me.设备列表.Requery
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo 数据更新前提醒_Err
If (MsgBox("是否保存对记录的修改", 1, "修改记录提醒") = 1) Then
Beep
Else
DoCmd.RunCommand acCmdUndo
End If
数据更新前提醒_Exit:
Exit Sub
数据更新前提醒_Err:
MsgBox Error$
Resume 数据更新前提醒_Exit
End Sub
设备数据表
Private Sub 设备编号_DblClick(Cancel As Integer)
Forms("设备管理").Form.Filter = "设备编号='" & Me.设备编号 & "'"
Forms("设备管理").Form.FilterOn = True
Forms("设备管理").设备编号.SetFocus
End Sub
使用记录数据表
Private Sub 归还日期_DblClick(Cancel As Integer)
Me.归还日期 = Date
End Sub
Private Sub 领用日期_DblClick(Cancel As Integer)
Me.领用日期 = Date
End Sub