Solved

Beep is beeping only once

Posted on 2003-12-04
7
370 Views
Last Modified: 2010-05-03
I wrote the code
for i = to 5
     Beep
next i
but the computer beeps only once.
Why?
0
Comment
Question by:SaadDani
7 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 9880601
for i = 0 to 5
     Beep
next i
0
 

Author Comment

by:SaadDani
ID: 9880614
Its the same...
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9880726
Try this:

for i = 1 to 5
     Beep
     Doevents
next i

( I haven't tested it 'cos I don't have speakers at the moment )
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Expert Comment

by:dbrckovi
ID: 9880750
If this doesn't work then try using Timer to do the beeping in some time interval.    (Maybe the loop goes too fast.     Loop is finished even before the first beep finishes )

Create command button and a timer:
--------------------------------------------------------------------
Private Sub Command1_Click()
    Timer1.Interval = 300
    Timer1.Tag = 0
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    Timer1.Tag = Timer1.Tag + 1
    Beep
    DoEvents
    If Timer1.Tag = 5 Then Timer1.Enabled = False
End Sub
--------------------------------------------------------------------
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 100 total points
ID: 9880751
All the beeps are merged together.
Try this
Dim i As Integer
Dim j As Long
For i = 0 To 5
     Beep
     For j = 1 To 10000000
     Next j
Next

0
 

Author Comment

by:SaadDani
ID: 9880756
dosn't help...
0
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9880793
Timer method works fine for me.
The lowest value of Timer1.Interval that gives multiple beeps on my comp. is 50. Everything larger than this works fine.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help in WHSCRIPT 9 47
Opening Remote & Local Data Connection 2 51
Windows 10 start screen issues 9 51
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 42
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now