Sniper-BoOyA-
Registered User.
- Local time
- Today, 13:41
- Joined
- Jun 15, 2010
- Messages
- 204
Good Morning,
A couple of months ago i made a function in VBA to audit changes made using forms. Everything works perfect, the code i am using atm is:
Everything works great. But theres just one thing i would like to try out. As you can see i use CurrentUser() to save the user logged into Access, is it possible to lets say
IF CurrentUser()= UserA then nothing has to be saved?
Thanks for your time!
A couple of months ago i made a function in VBA to audit changes made using forms. Everything works perfect, the code i am using atm is:
Code:
Public Function TrackChanges()
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim strCtl As String
Dim strReason As String
Form_ActivityMonitor.LastAction = Now()
If Not Screen.ActiveControl.OldValue = Empty Then
strReason = InputBox("Wat is de reden voor deze wijziging? (Max 40 tekens)")
End If
strCtl = Screen.ActiveControl.Name
strSQL = "SELECT Audit.* FROM Audit;"
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount > 0 Then rs.MoveLast
With rs
.AddNew
rs!FormName = Screen.ActiveForm.Name
rs!Veldnaam = strCtl
rs!datum = Date
rs!Tijd = Time()
rs!OudeWaarde = Screen.ActiveControl.OldValue
rs!NieuweWaarde = Screen.ActiveControl.Value
rs!Gebruiker = fOSUserName
rs!LoggedIn = CurrentUser()
rs!Computer = FindComputerName
rs!Reason = strReason
.Update
End With
Set db = Nothing
Set rs = Nothing
End Function
Everything works great. But theres just one thing i would like to try out. As you can see i use CurrentUser() to save the user logged into Access, is it possible to lets say
IF CurrentUser()= UserA then nothing has to be saved?
Thanks for your time!