Prompted twice to save

G

Guest

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

Similar Threads

Docmd.Close Error 1
Case vbNo 5
confirm saving 1
Validation 6
All Forms Close on DoCmd.Close 4
Form Closing Regardless of B4Update Response 6
Form_BeforeUpdate 1
Copy backend db in run mode. - Re-post 2

Top