完善窗体数据修改历史记录的示例
时 间:2023-08-18 16:24:33
作 者:vincent ID:20933 城市:广州
摘 要:改成这样会更方便给每个窗体直接调用。
正 文:
http://www.accessoft.com/article-show.asp?id=20823
我给他完善了一下,改成这样会更方便给每个窗体直接调用,改动的代码如下:
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快速开发平台QQ群 (群号:321554481) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access查询身份证格式位数...(09.22)
- 【Access TOP取值示例...(09.11)
- 【Access批量设置条件格式...(09.04)
- 【Access批量设置条件格式...(08.30)
- Access仿平台的多值选择器...(08.24)
- Access通过按钮获取当前选...(08.23)
- 【Accesss Column...(08.11)
- Access自定义小数位的示例(07.25)
- 【Accesss源码示例】提取...(07.17)

学习心得
最新文章
- 2023中秋快乐!!!(09.29)
- Access控件值满足条件时,下一...(09.28)
- 如何给组合框字段设置行来源SQL代...(09.27)
- 《Access快速开发基础教程》免...(09.26)
- Microsoft Access ...(09.25)
- Microsoft Access ...(09.25)
- 【Access条件格式示例】Acc...(09.25)
- Access快速开发平台--通用附...(09.22)
- 您为该字段输入的值无效/您可能在数...(09.22)
- Access查询身份证格式位数不正...(09.22)