ModifiedBy

  • Thread starter Thread starter PBrown
  • Start date Start date
P

PBrown

What I need to do is have the user ID and time recorded
when a user changes then information on a record.


Here is some of the basic info for the form:
Form: Car
Subform Name: Car Detail
Subform Control Source: Car subform
Subform field that would be modified: Description

Currently for fields that would be modified in the main
part of the form, below is what is coded for the On Change
Event:
Me!MgtModifiedDate = Now()
Me!MgtModifiedBy = Environ("username")


However, how/where would this go for noting a modification
of the Description field in the subform?
Thank you for any and all help,

PBrown
 
See comments in-line.

--
HTH
Van T. Dinh
MVP (Access)



PBrown said:
What I need to do is have the user ID and time recorded
when a user changes then information on a record.


Here is some of the basic info for the form:
Form: Car
Subform Name: Car Detail
Subform Control Source: Car subform
Subform field that would be modified: Description

Currently for fields that would be modified in the main
part of the form, below is what is coded for the On Change
Event:
Me!MgtModifiedDate = Now()
Me!MgtModifiedBy = Environ("username")
I would normally use the (main) Form_BeforeUpdate rather than Change Event.

However, how/where would this go for noting a modification
of the Description field in the subform?
Similarly, use the Form_BeforeUpdate Event of the Form you used as the
ObjectSource of the SubformControl.
 
What you call "Subform" is actually 2 distinct objects:

1. A Subform Control which is basically the *empty* rectangle. This main
purpose is to set the filter so that the "Subform" only show the Child
Records related to the Record on the main Form.

2. The SourceObject which is usually a Form which sits inside the Subform
Control and displays the related Child Records. What the sentence meant is
that you can use the BeforeUpdate Event of the Form that you used as the
SourceObject to do the same thing.

Unfortunately, with new Access versions, you can use a DatasheetView of a
Table or Query as the SourceObject. If this is the case, you need to create
a Form (using the Form Wizard if possible and you can use the DatasheetView
of the Form) and use this Form as the SourceObject.

If you are not sure how to write BeforeUpdate Event (How did you write the
Change Event you posted?), check Access VB Help or your Access VBA book. I
think there is an example in Help.
 
Back
Top