Mình có tạo lệnh xóa 1 record như bên dưới nhưng ko chạy
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_cmdDelete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
Nó báo lỗi:
Complie eror: Label not defined
Xin các bạn tư vấn
Đã thử 1 lệnh khác
Make a Module like:
Code:
Function DeleteARecord
If MsgBox ("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") = vbYes Then
If MsgBox ("Are you SURE you want to delete this record?" & vbCrLf & _
"This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation") = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
End If
End If
End Function
Then in the On Click Event for the button in the form:
Code:
Private Sub DeleteButton_Click()
DeleteARecord
End Sub
Nó lại báo lỗi đoạn DoCmd.RunCommand acCmdDeleteRecord