UPDATE got write conflic error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,Group. Am experiencing an update problem...
On my form I used a textbox (text95)to show the login user name. and I also
write those code

DoCmd.RunSQL "UPDATE Mmaster SET Mmaster.[Requestor] = [Text95] WHERE
((ID=Forms![Assetsub]![ID]))"

in the form_beforeupdate event to record the user as an operator.However,
every time I save there is an ""write conflict" error. even when I force to
save it
How could this happen? Can anyone help ? Many thanks ...
 
I am not sure I understand your question correctly but it sounds like while
the Form is updating the current Record on the Form, you are trying to
update the same record using the RunSQL statement in a different process???

This is most likely will give you a write conflict error ...

If you want to record the UserID who modifies the Record, you should not use
the Update Query (which runs in a separate process). I think ou should
simply use:

Me.UpdatedBy = Me.Text95


(assuming [UpdatedBy] is included in the Form's RecordSource) in the
Form_BeforeUpdate Event and the Form's updating process will update the
record with the value in [Text95] as the value for [UpdatedBy].

You may even be able (depending on your set-up) to bind the [Text95] Control
to your Field [UpdatedBy] and the UserID will be updated automatically.
 
Back
Top