vbYesNo add timer

  • Thread starter Thread starter lmv
  • Start date Start date
L

lmv

How do I have the following automatically default to "yes save changes" and
close after a few seconds?

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "Do you want to SAVE changes?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then

Else
Me.Undo
Cancel = True
End If
End Sub
 
While you can default a button with the built-in MsgBox, it's really not
intended to be closed automatically.

You'd be best off creating your own form that looks like a message box and
control it.

You could also take a look at my May, 2005 "Access Answers" column in
Pinnacle Publication's "Smart Access". You can download the column (and
sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html Not sure I'd really
recommend using that technique in a production application though.
 
Back
Top