前言:
今天各位老铁们对“查看7天历史记录”大体比较珍视,你们都想要知道一些“查看7天历史记录”的相关内容。那么小编同时在网上汇集了一些对于“查看7天历史记录””的相关内容,希望大家能喜欢,咱们一起来学习一下吧!完善窗体数据修改历史记录的示例,这样会更方便给每个窗体直接调用。
之前学弟分享的《窗体数据修改历史记录的示例;记录Access字段编辑保存日志的示例;记录字段操作日志【Access软件网】》
我给他完善了一下,改成这样会更方便给每个窗体直接调用,改动的代码如下:
Public Function LoadRecordToTag(frm As Object)
Dim ctl As Control
For Each ctl In frm.Controls
If (ctl.ControlType = acComboBox Or ctl.ControlType = acTextBox) And ctl.Name <> "历史记录" And ctl.Name <> "NoCheck" Then
If frm.Controls(ctl.Name).Locked = False Then
frm.Controls(ctl.Name).Tag = "<" & frm.Controls(ctl.Name) & ">"
End If
End If
Next
End Function
Public Function SaveRecordChange(frm As Object, ID As String)
Dim changeTXT As String
Dim ctl As Control
Dim str1 As String
For Each ctl In frm.Controls
If (ctl.ControlType = acComboBox Or ctl.ControlType = acTextBox) And ctl.Name <> "历史记录" And ctl.Name <> "NoCheck" Then
If frm.Controls(ctl.Name).Locked = False Then
str1 = Trim(frm.Controls(ctl.Name & "_Label").Caption)
If frm.Controls(ctl.Name).Tag <> "<" & frm.Controls(ctl.Name) & ">" Then
changeTXT = changeTXT & str1 & frm.Controls(ctl.Name).Tag & "→<" & frm.Controls(ctl.Name) & ">;"
End If
End If
End If
Next
If changeTXT <> "" Then
Set rst = CurrentDb.OpenRecordset("tbl操作日志", dbOpenDynaset)
rst.AddNew
rst!编号 = frm![ID]
rst!用户 = GetParameter("Current User nickname")
rst!时间 = Now()
rst!修改历史 = changeTXT
rst.Update
rst.Close
End If
End Function
'加载数据到控件tag中,监视是否有修改
Call LoadRecordToTag(Me)
‘保存
If Not Me.DataEntry Then
Call SaveRecordChange(Me, Me![PID])
End If
完善窗体数据修改历史记录的示例【Access软件网】
标签: #查看7天历史记录