title: Record deleting after setting me.AllowDeletions to false
body: <p>Using Access 2007 front end with SQL Server 2008 r2 back end.  I have records that can be ticked as 'Patient Seen'.  If 'Patient Seen' is True then deletion is not supposed to happen.  Conversely if 'Patient Seen' is false deletion of record is allowed.  What I have so far is this:</p>
  
  <pre><code>    Set db = CurrentDb
      Set rs = db.OpenRecordset("select PatientSeen,PatientLogID from PatientLog where           PatientLogID = " &amp; Me.PatientLogID, dbOpenDynaset, dbSeeChanges)
      test = rs!PatientLogID
      If MsgBox("Are you sure you want to delete record?", vbYesNo, "Delete Record") =   vbYes Then
      If rs!PatientSeen = False Then
  
      strSQL = "UPDATE [PatientLog] " _
         &amp; "Set IsDeleted = 1 " _
         &amp; "Where PatientLogID = " &amp; Me.PatientLogID
      'View evaluated statement in Immediate window.
      Debug.Print strSQL
      DoCmd.SetWarnings False
      DoCmd.RunSQL strSQL
  
      ElseIf rs!PatientSeen = True Then
      MsgBox ("Patient already seen, cannot delete")
      Me.AllowDeletions = False
      'Me.Undo
      End If
      Else
      Me.Undo
      Exit Sub
      End If      
  </code></pre>
  
  <p>The Patient Seen false works fine.  It updates the IsDeleted to 1 for the correct record.  However if the Patient Seen is True the msgbox (Patient already seen...) pops up but the record still gets completely deleted from table instead of.  Same for if I click no on the initial question of 'sure you want to delete'.  Instead of just exiting sub it deletes the record.  </p>
  
  <p>Im still fairly new to Access and building a back end SQL but pretty familiar with VBA from years of Excel reports.  Any suggestions greatly apprecitated.</p>