记录事件 [英] Log of events

查看:71
本文介绍了记录事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!那里的每个人都很高兴和你在一起。我目前在MS Access 2007中使用VBA创建数据库。我想记录表单上正在执行的所有事件,以跟踪更改日期/时间所做的更改。我想为上述目的制作一张桌子。如果有人能帮我实现上述目标,我将不胜感激。谢谢。

Hi! everyone there its nice to be with you. Im currently working in MS Access 2007 creating databases with VBA. I want to keep log of all the events that are being carried on the form to track the changes done with the date/time of the changes. I would like to make a table for the said purpose. I would much appreciate if someone could please help me achieve the said goal. Thankx.

推荐答案

先生。 Imran,

您需要创建表名目的,列名如下(1)UserID:文本
(2)EventName:文本
(3)iTimeDate :日期/时间
(4)iDescription:文本


对于您需要记录的每个事件,请在其上应用以下程序。

Sub LogEvent(iUserID As String,iEventName As String,iDescription As String)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' iTimeDate,iDescription)值('&& Trim(iUserID)&"','"& Trim(iEventName)&"',now(),'"& Trim(iDescription)& ;'')'''''''''''''''''''''''''''''''''''''' LogEvent将被调用如下。

私人子Command0_Click()
''''''''''''''''''''''''''''''''''''''''' ; Command0_Click","这是B. utton点击事件,对于用户交互>''''''''''''结束子
你可以从变量动态使用相同的东西当前用户并记录它。

祝福。祝福。谢谢。
Mr. Imran,

You need to create table name Purpose with column name as below
(1) UserID : Text
(2) EventName : Text
(3) iTimeDate : Date/Time
(4)iDescription : Text


And on every event which you need to log, apply below procedure on it.

Sub LogEvent(iUserID As String, iEventName As String, iDescription As String)
''''''''''''''
    DoCmd.RunSQL "Insert into Purpose (UserID,EventName,iTimeDate,iDescription) Values('" & Trim(iUserID) & "','" & Trim(iEventName) & "',now(),'" & Trim(iDescription) & "')"
''''''''''''''
End Sub


For example on button click event , LogEvent will be called as below.

Private Sub Command0_Click()
''''''''''''''
    LogEvent "Imran Ghani", "Command0_Click", "This is Button Click Event, For user interaction"
''''''''''''''
End Sub

u can use the same thing dynamically from the variable of current user and log it.

Best Wishes. Thanks.





这篇关于记录事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆