Microsoft Access VBA Programming for the Absolute Beginner
Makes a sound using the computer’s built-in speaker.
Syntax
DoCmd.Beep()
Example
The following code causes the computer to sound a beep whenever the user enters a non-numeric value in the zip code field:
Private Sub txtZipCode_Change() If Not IsNumeric(Me.txtZipCode) Then Beep End If End Sub
Comments
-
The Beep method corresponds to the intrinsic VBA Beep statement.
-
The duration and frequency of the beep are hardware dependent.
-
On systems with sound cards, the beep is defined by the sound assigned to the Default Beep program event in the Control Panel Sounds applet.
-
Although calls to DoCmd.Beep or the Beep statement may be appropriate in some cases (such as particular kinds of data entry errors), they are rarely used in VBA programming.
Категории