Prompted twice to save

E

EdS

Hello.. I have a command button to close a form which checks that a field
(VOL1) is greater than one. For some reason, I am being prompted twice to
save the record. Can anyone solve this for me?

Here is the code:

Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
Dim intResponse As Integer

intResponse = MsgBox("Save New Record?", vbYesNo)

Select Case intResponse
Case vbYes
If (VOL1) >= 1 Then
DoCmd.Close
Else
MsgBox ("VOL 1 Must be at least one.")
Me.VOL1.SetFocus
End If
Case vbNo
Me.Undo
DoCmd.Close
End Select

Exit_cmdExit_Click:
Exit Sub

Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top