M
Merwin12
HI,
I have a delete command button which produces this error:
Update or CancelUpdate without Addnew or Edit
This is the code behind it:
Dim DB As Database
Dim rs As Recordset
Dim msg As String
Dim CR As String
CR = Chr(13)
msg = "Are you sure you want to delete this record?"
If MsgBox(msg, vbQuestion + vbYesNo) = vbNo Then
response = acDataErrContinue
MsgBox " Please try again.", vbInformation, "Project
Storage"
Me.DELETED = ""
Else
'user wants to delete the record
Set DB = DBEngine.Workspaces(0).Databases(0)
'Set DB = CurrentDb
Set rs = DB.OpenRecordset("TblNwkStorage",
dbOpenDynaset)
On Error Resume Next
'Delete the record
rs.Delete
rs![DELETED] = "D"
rs.UPDATE
rs.close
Set rs = Nothing
If Err Then
response = acDataErrContinue
MsgBox Error$ & CR & CR & "Please try again.",
vbExclamation, "Project Storage"
Else
response = acDataErrAdded
End If
End If
I can't find the root of this problem.
Pls. help.
thanks.
I have a delete command button which produces this error:
Update or CancelUpdate without Addnew or Edit
This is the code behind it:
Dim DB As Database
Dim rs As Recordset
Dim msg As String
Dim CR As String
CR = Chr(13)
msg = "Are you sure you want to delete this record?"
If MsgBox(msg, vbQuestion + vbYesNo) = vbNo Then
response = acDataErrContinue
MsgBox " Please try again.", vbInformation, "Project
Storage"
Me.DELETED = ""
Else
'user wants to delete the record
Set DB = DBEngine.Workspaces(0).Databases(0)
'Set DB = CurrentDb
Set rs = DB.OpenRecordset("TblNwkStorage",
dbOpenDynaset)
On Error Resume Next
'Delete the record
rs.Delete
rs![DELETED] = "D"
rs.UPDATE
rs.close
Set rs = Nothing
If Err Then
response = acDataErrContinue
MsgBox Error$ & CR & CR & "Please try again.",
vbExclamation, "Project Storage"
Else
response = acDataErrAdded
End If
End If
I can't find the root of this problem.
Pls. help.
thanks.