log report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

good morning,

is it possibile to create a log report for any changes done by the user. i.e
user1 insert record one, user2 delete second row and so on.

thank you in advance
 
kawther said:
good morning,

is it possibile to create a log report for any changes done by the user.
i.e
user1 insert record one, user2 delete second row and so on.

thank you in advance

Yes but it's not an "out of the box" solution, you have to code it yourself.
Here's an example of code that works well for me. It assumes several
things, including having certain tables and queries in place but you should
be able to work all that out from the code. Hope it helps.

Keith.
www.keithwilby.com

Public Function libHistory(frmForm As Form, lngID As Long, strTrans As
String)

'Author: Keith Wilby
'Date: 05 July 2005
'Purpose: Record data transactions in tblHistory
'Called from: Form_BeforeUpdate & Delete events

Dim ctl As Control
Dim db As DAO.Database, rs As Recordset, strSQL As String, strUser As
String
Set db = CurrentDb
strSQL = "Select * From qryHistory;"
Set rs = db.OpenRecordset(strSQL)
strUser = fOSUserName()

For Each ctl In frmForm
'Ignore controls such as labels
If TypeOf ctl Is TextBox or TypeOf ctl Is ComboBox Then
'Record null to value, value to null, and value changes
If ((IsNull(ctl.OldValue) And Not IsNull(ctl.Value)) Or
(IsNull(ctl.Value) And Not IsNull(ctl.OldValue)) _
Or ctl.OldValue <> ctl.Value) Then
With rs
.AddNew
![DataSource] = frmForm.Name
![ID] = lngID
![FieldName] = ctl.ControlSource
![OldValue] = ctl.OldValue
![NewValue] = ctl.Value
![UpdatedBy] = strUser
![UpdatedWhen] = Now()
.Update
End With
End If
End If
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing

End Function
 
rhank you it will help, also i would like to create a custom log in with user
id and password without security wizard, i have create the form but i do not
the coding
 
thank you again for you help, iam in process of making the history report,
please advise me the steps
1.create table history ,what fields should it contins?
2.the vb in which event
3.i have 6 form
please if u dont me show me the way to create the code and the history report

thank you again

">
 
Back
Top