Kiwiman
Registered User
- Local time
- Today, 17:28
- Joined
- Apr 27, 2008
- Messages
- 799
Hi All
We have moved an access backend to SQL Server 2000, and use Access 2k as the front end.
When a user tries to delete a line record using the following code
we get an error message
I changed the code to
but got a message
Doing some searching on this forum, I amended my code to be the below. I get no error messages, but the record is not deleted either.
Any ideas?
We have moved an access backend to SQL Server 2000, and use Access 2k as the front end.
When a user tries to delete a line record using the following code
Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
we get an error message
The DoMenuItem action was cancelled
I changed the code to
Code:
DoCmd.RunCommand acCmdDeleteRecord
but got a message
You must see the DBSeeChanges option with open recordsets when access a SQL Server table that has an identity column
Doing some searching on this forum, I amended my code to be the below. I get no error messages, but the record is not deleted either.
Any ideas?
Code:
Private Sub cmdDelRec_Click()
On Error GoTo Err_cmdDelRec_Click
Dim strSQL As String
Dim intLineNo As Integer
intLineNo = Me.ContLineNo
strSQL = "delete from tblContAttribLin where ContLineNo = " & intLineNo
If MsgBox("Delete this record?", vbQuestion + vbYesNo, "Delete?") = vbYes Then
CurrentDb.Execute strSQL, dbSeeChanges
Me.Refresh
End If
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'DoCmd.RunCommand acCmdDeleteRecord
Exit_cmdDelRec_Click:
Exit Sub
Err_cmdDelRec_Click:
MsgBox Err.Description
Resume Exit_cmdDelRec_Click
End Sub