Beep in a MsgBox

M

M Skabialka

When I use this code on a Close the Database button, it beeps loudly, but I
don't see where it is telling it to beep. Users HATE the beep.

Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to close Access and this Database?" ' Define
message.
Style = vbYesNo + vbCritical + vbDefaultButton1 ' Define buttons.
Title = "Quit Application" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
DoCmd.Quit
End If

I took out vbCritical and it still beeps, though softer. What is calling
the beep command?
 
D

Dirk Goldgar

M Skabialka said:
When I use this code on a Close the Database button, it beeps loudly, but
I don't see where it is telling it to beep. Users HATE the beep.

Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to close Access and this Database?" ' Define
message.
Style = vbYesNo + vbCritical + vbDefaultButton1 ' Define buttons.
Title = "Quit Application" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
DoCmd.Quit
End If

I took out vbCritical and it still beeps, though softer. What is calling
the beep command?


It's the MsgBox function. Different styles are associated with different
system sounds. At the system level, you can find these sounds in the
control panel Sounds applet, on the Sounds tab (at least in Vista). Check
out the system sounds called "Default Beep", "Question", "Exclamation", and
"Critical Stop".

Users can change or disable these sounds at the system level, but I don't
believe you can change them just for your application's message boxes -- at
least, not easily; there may possibly be something clever you could do with
Windows API calls, but I've never looked into it. My recommendation would
be to use the appropriate styles in your message boxes, `and leave it up to
the user to set the sounds for each level of alert in their control panel.
 
M

M Skabialka

I hadn't realized this was out of control of the developer, thanks for the
info.
Taking vbCritical out has made it easier on the users though.
Mich
 

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