Hi i have this piece of code in my access databse that tracks changes made to 1 form. the code work properly.
I upgrating my databse to SQL using access as the front end application. All forms will be in access and all Tables in SQL. The access DB will be linked to the SQL to access the data.
For some reason the code that worked fine in acces now doesn't work. Here is the code:
I upgrating my databse to SQL using access as the front end application. All forms will be in access and all Tables in SQL. The access DB will be linked to the SQL to access the data.
For some reason the code that worked fine in acces now doesn't work. Here is the code:
Code:
Public Function TrackChanges()
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim strCtl As String
strCtl = Me.ActiveControl.Name
'strCtl = 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 = Me.Name
rs!ControlName = strCtl
rs!DateChanged = Date
rs!PriorInfo = Me.ActiveControl.OldValue
rs!NewInfo = Me.ActiveControl.Value
rs!CurrentUser = fOSUserName
rs!ProjectID = Me.ProjectID
rs!ID = Me.ID
.Update
End With
Set db = Nothing
Set rs = Nothing
End Function
[code/]
this is the error message i get:
"The expression Before Update as the event as gthe event property setting produced the following error:"
The expression may not result in the name of a macro, the name of a user-defined function, or [event Procedure]
Any ideas why?