Previously I had been running Access applications through paces "torture testing" and had come up with three DoEvents being required to completely flush the input queue of all Esc / Cancel requests. Abridged example:
	
	
	
		
Well that is all fine and dandy unless... 
 there happens to be a "Loose Changes Yes/No box" which pops up. Scenario of how to still crash Access:
	
	
	
		
So I have had to stoop to doubling up my DoEvents to flush the buffer, as follows:
	
	
	
		
 
		Code:
	
	
	Private Sub btnClose_Click()
  'Flush keystrokes out of the buffer so that close via Esc does not generate an error msg
  DoEvents
  DoEvents
  DoEvents
  'Close window "self"
  Call uiutils_CloseForm(Me)
End Sub
	- Press Esc on an Edit Record form
 - Yes/No Loose Changes box comes up (VBA MsgBox style)
 - Press Esc several more times
 - Then press the "Yes" button to really abandon changes
 - VBA then crashes having detected a Cancel in the input queue :banghead:
 
		Code:
	
	
	  'Confirm dialog here...
  intRC = MsgBox("Abandon any Fandango Part Edit changes?", vbYesNo + vbQuestion + vbDefaultButton2, "Confirm Close without Save?")
  If intRC = vbNo Then
    GoTo Exit_btnRollback_Click
  End If
	
		Code:
	
	
	Private Sub btnRollback_Click()
  Dim intRC As Integer
  'Flush keystrokes out of the buffer so that close via Esc does not generate an error msg
  DoEvents
  DoEvents
  DoEvents
  'Confirm dialog here...
  intRC = MsgBox("Abandon any Fandango Part Edit changes?", vbYesNo + vbQuestion + vbDefaultButton2, "Confirm Close without Save?")
  'Flush keystrokes out of the buffer so that close via Esc does not generate an error msg
  DoEvents
  DoEvents
  DoEvents
  If intRC = vbNo Then
    GoTo Exit_btnRollback_Click
  End If
  'Close window "self"
  Call uiutils_CloseForm(Me)
Exit_btnRollback_Click:
  Exit Sub
End Sub