SpirituaLee
Registered User.
- Local time
- Today, 02:19
- Joined
- Dec 5, 2007
- Messages
- 16
So sorry to be impatient, but I'd be so very grateful of some help on this.
Call AuditTrail(Me, "FieldNameHereInQuotes", Me!FieldnameHere)
You need to provide the correct function call. For a subform you would need to use
Call AuditTrail(Me.SubformControlNameHere.Form, "Unique Field NameHere in Quotes", Me.SubformControlNameHere.Form![RecordIDFieldNameHere])
where SubformControlNameHere refers to the control on the parent form which HOUSES the subform. You need to use its name instead of the subform name unless the subform control name and the subform name are exactly the same.
I was wrong - it would be in the subform's BEFORE UPDATE event and since it would be on that form, you should be able to just use
I was all turned around with my other answer and I realized it as I read it again.Code:Call AuditTrail(Me, "FieldNameHereInQuotes", Me!FieldnameHere)
Aha, thanks Bob, did't see your correction above! I'll get on it now, thanks so much.
Post the entire code you used in the FORM'S BEFORE UPDATE event.
Call AuditTrail(Me, "change_id", Me!change_id)
You put that code in the VBA Window and NOT in the event property?
See here for the correct place to put that code:
http://www.btabdevelopment.com/ts/eventcode
Private Sub Form_BeforeUpdate(Cancel As Integer)
Call AuditTrail(Me, "change_id", Me!change_id)
End Sub
The second one is correct but if you can't edit, then is change_id really the field on the subform that you should be trying to capture? What is the primary key of the data for the SUBFORM, not the main form. If it is, then is change_id really the way it is spelled or is there a space in the field name?I've tried both the Event Property (which results in the message above)and the VBA Window, under BeforeEvent..
Code:Private Sub Form_BeforeUpdate(Cancel As Integer) Call AuditTrail(Me, "change_id", Me!change_id) End Sub
The latter, results in me not being able to create a record, or edit a record in the subform, meaning I have to press escape to revert to how the record was.
Can you upload a copy of your database? I am having trouble figuring out why it isn't working (I've done it before with subforms and haven't had any of that trouble).
sTable = frm.RecordSource
sPCName = Environ("COMPUTERNAME")
sPCUser = Environ("Username")
sDBUser = "Me" 'Get Username from the database login
sDateTime = Now()
how to changee "me" in tblAudit log Dbuser field to be another user login from my login table?
If you are using Access User Level Security you can use
sDBUser = CurrentUser()
how to set up Access User Level Security in version 2007/2010 ?.