I have a form with a close button on it. When I press the close button, I want it to close the form without saving the data. When I first open the form the close button doesn't work the first time I click it. It works every time after that, but I can not figure out why it doesn't work the first time. What am I doing wrong, or what am I missing?
Thanks for the assist!!
Dave
Code:
Private Sub cmdOpticClose_Click()
Dim response As Integer
If IsNull(Me.Title) And IsNull(Me.Text13) And IsNull(Me.Text15) Then
response = MsgBox(prompt:="Close form without saving?", buttons:=vbYesNo)
If response = vbYes Then
Cancel = True
Me.Undo
DoCmd.Close
Else
Cancel = True
End If
End If
End Sub
Thanks for the assist!!
Dave