Disabling sound

I am using a form with multiple text boxes. I have entered code for a keypress event that accepts the Enter key, which moves focus to the next text box. When the app is running and I press  the Enter key to step to the next text box, I hear the selected windows sound for an error. If I press the Tab key, I do not get the sound. I do not want to turn the sound off in the Windows control panel - sounds. How can I disable the sound at the instant I press the Enter key? I do not want to disable the sound entirely, when the app is running.
dmoore2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VbmasterCommented:
Set KeyCode = 0 in the KeyDown event.
0
VbmasterCommented:
But only when KeyCode = 13 of course. ;)

If (KeyCode = vbEnter) Then
  KeyCode = 0
  'You have your setfocus code here perhaps?
End If

0
adityauCommented:
You can use KeyAscii = 0 in the KeyPress event event itself. If you don't use it, beep will come. If you say KeyAscii = 0 and set the focus to another text box, it does not give any beep.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.