msg box vb YesNoCancel - Promtet twice on Yes

Kan

Joined
Sep 2, 2009
Messages
6
Reaction score
0
My form has a save cmd button with the following code:
Code:
  Private Sub Save_Customer_Button_Click()
On Error GoTo Err_Save_Customer_Button_Click
	
	DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
	[Stop time] = Time
	[TotalTime] = Diff2Dates("hns", [Start time], [Stop time], 0)
	DoCmd.GoToRecord , , acNext
	   
Exit_Save_Customer_Button_Click:
	
	Exit Sub
   
Err_Save_Customer_Button_Click:
	MsgBox Err.Description
	Resume Exit_Save_Customer_Button_Click
  
End Sub

I also intrduced a yesNoCancel msg box with the code:

Code:
 Private Sub Form_BeforeUpdate(Cancel As Integer)
Select Case MsgBox("Salvati Inregistrarea?", vbYesNoCancel, "Atentie!!")
Case vbYes
  'code
  Save = True
  [Stop time] = Time
  [TotalTime] = Diff2Dates("hns", [Start time], [Stop time], 0)
Case vbNo
  'code
  Me.Undo
Case vbCancel
  'code
Cancel = True
  End Select
End Sub

When the user clicks the save button and hits yes on prompt the yes msj si prompted twice. Why?
 

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