Private Sub cmdCancel_Click()
Dim message As String
Dim rstAppt As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM tbl_APPTs WHERE CLIENT_ID = '" & Me.CLIENT_ID & "' AND APPT_ID = '" & Me.APPT_ID & "'"
Set rstAppt = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
message = MsgBox("Do you want to delete this appointment?", vbYesNoCancel)
If message = vbYes Then
'Delete this appointment
DoCmd.Close , "", acSaveNo
rstAppt.Delete
End If
If message = vbNo Then
Me.Dirty = False
End If
End Sub
|