jgoodman00
Programmer
- Jan 23, 2001
- 1,510
I have the following procedure running in the before_update event of several forms. In all but one it works perfectly. However, on one particular form it errors, stating that 'Update or CancelUpdate without AddNew or Edit'. This seems a little strange, because I have only seen this error applying to DAO manipulation (where you have to set a recordset to edit or add). However, I am simply trying to assign a couple of variables to a couple of controls. This is simple, but on this one form will not work.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
If MsgBox("The record has been changed, would you like to save the changes?", vbYesNoCancel) = vbYes Then
Me.ModUser = Environ("UserName"
Me.ModDate = Now
Else
Me.Undo
End If
End If
End Sub
Has anybody else had this error, when not using DAO? I am thinking it is something to do with the form properties, but the obvious properties seem ok (such as AllowEdits etc).
James Goodman
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
If MsgBox("The record has been changed, would you like to save the changes?", vbYesNoCancel) = vbYes Then
Me.ModUser = Environ("UserName"
Me.ModDate = Now
Else
Me.Undo
End If
End If
End Sub
Has anybody else had this error, when not using DAO? I am thinking it is something to do with the form properties, but the obvious properties seem ok (such as AllowEdits etc).
James Goodman