hi guys, i have a close button on the form, if the form is dirty it pops up the message "do you want to save changes"?. My problem is that i can close the form when its not dirty, but when then msg pop us and hit either Yes or No it does nothing. Please suggest if the code below is right (only begginer in Vba) :
Private Sub cmd_CloseCustomerInfo_Click()
Dim Answer As String
If Me.Dirty Then
MsgBox "Do you want save changes?", vbQuestion + vbYesNo
Select Case Answer
Case vbYes
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdClose
Case vbNo
DoCmd.RunCommand acCmdClose
End Select
Else
DoCmd.RunCommand acCmdClose
End If
End Sub