MHadden
Programmer
- May 13, 2001
- 105
I am using the following code, but keep getting the following error "Update or CancelUpdate without Addnew or Edit"
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyDB As Database
Dim MySet As Recordset
Set MyDB = CurrentDb
Set MySet = MyDB.OpenRecordset("Updates"
MySet.AddNew
MySet!FirstName = Me!FirstName.OldValue
MySet!LastName = Me!LastName.OldValue
MySet!ServiceType = Me!ServiceType.OldValue
MySet!LastConcCheck = Me!LastConcCheck
MySet!DateChanged = Now()
MySet!User = CurrentUser()
MySet.Update
MySet.close
MyDB.close
End Sub
I have studied the help files, and this forum, but can't find an answer to why it isn't working. It appears to me to be accurate & have the right syntax, but who knows? Can anyone help?
TIA - Michael
MichaelHadden@AltaVista.Com
If you give someone a fish, you have given them a meal. If you teach someone to fish, you have given them MANY meals!
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyDB As Database
Dim MySet As Recordset
Set MyDB = CurrentDb
Set MySet = MyDB.OpenRecordset("Updates"
MySet.AddNew
MySet!FirstName = Me!FirstName.OldValue
MySet!LastName = Me!LastName.OldValue
MySet!ServiceType = Me!ServiceType.OldValue
MySet!LastConcCheck = Me!LastConcCheck
MySet!DateChanged = Now()
MySet!User = CurrentUser()
MySet.Update
MySet.close
MyDB.close
End Sub
I have studied the help files, and this forum, but can't find an answer to why it isn't working. It appears to me to be accurate & have the right syntax, but who knows? Can anyone help?
TIA - Michael
MichaelHadden@AltaVista.Com
If you give someone a fish, you have given them a meal. If you teach someone to fish, you have given them MANY meals!