C
charles.kendricks
I have a form which is used to input customer data. The same form
also has a button whose OnClick event causes the form to be
repopulated using a query that prompts for the desired customer last
name...to look up specific customer records. So far, so good. I
recently was asked to monitor who (what users) input or update which
records. So I created two additional fields in the customer records
UpdatedBy, and UpdateTime. I use the BeforeUpdate event of the form
to assign the user and time to those two controls on the form
Private Sub Form_BeforeUpdate(Cancel As Integer)
UpdatedBy = CurrentUser()
UpdateTime = Now()
End Sub
This seems to work fine, also....However when I click the button to
look up the same record that was just created with the form, first of
all the controls on the form don't display the user or time
information that was saved in the record,...and worst of all when I
edit, or change the customer data, such as updat his phone number, and
try to save the record I get a Run-time error that says "You can't
assign a value to this object" when I hit the 'debug' button the
UpdatedBy = CurrentUser() is highlighted.
also has a button whose OnClick event causes the form to be
repopulated using a query that prompts for the desired customer last
name...to look up specific customer records. So far, so good. I
recently was asked to monitor who (what users) input or update which
records. So I created two additional fields in the customer records
UpdatedBy, and UpdateTime. I use the BeforeUpdate event of the form
to assign the user and time to those two controls on the form
Private Sub Form_BeforeUpdate(Cancel As Integer)
UpdatedBy = CurrentUser()
UpdateTime = Now()
End Sub
This seems to work fine, also....However when I click the button to
look up the same record that was just created with the form, first of
all the controls on the form don't display the user or time
information that was saved in the record,...and worst of all when I
edit, or change the customer data, such as updat his phone number, and
try to save the record I get a Run-time error that says "You can't
assign a value to this object" when I hit the 'debug' button the
UpdatedBy = CurrentUser() is highlighted.