If the data in the form dirty
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'If the form is dirty and the user presses page up or
'page down, ignore the keystroke
If Me.Dirty Then
If KeyCode = vbKeyPageDown Or _
KeyCode = vbKeyPageUp Then
KeyCode = 0
End If
End If
End Sub
Related examples in the same category