I
Irshad Alam
My requirement was to read the the names of the employee with sound - each
after 2 seconds interval
On the Employee Form ( EMpFormA) I add a Label and wrote the following code
(which was earlier
helped by Mr. Dougless Steel answer posted for my question. I modified
little to suit my
requirement, I mean I modified to function so that I can use several
places). It runs perfect.
After clicking the label the curson moves from one record to another and it
reads the name of the
employee after 2 seconds gap. Its ok. BUT the problem is something else
which I have mentioned
after the code below:
Private Sub Label17_Click()
On Error Resume Next
Dim GetTotalEmp As Integer
Dim RunTimeA As Integer
Dim pausetime, start, finish
GetTotalEmp = DCount("[ENamee]", "[EmpCurQA]")
DoCmd.RunCommand acCmdRecordsGoToFirst
Do
SpeakMyText (Me.ENamee)
RunTimeA = RunTimeA + 1
'Below line till loop hold the pause
pausetime = 2 ' Set duration.
start = Timer ' Set start time.
Do While Timer < start + pausetime
DoEvents ' Yield to other processes.
Loop
finish = Timer
'till above
DoCmd.RunCommand acCmdRecordsGoToNext
Loop Until RunTimeA = GetTotalEmp
End Sub
Name of the Table : EmpTab1
Name of the Query : EmpCurQA
Name of the Form : EmpFormA
PROBLEM :
1. Is the code above perfect. OR it may have been written in another way.
2. When I click to run the code, it works ok, BUT when I close the form
inbetween (before
completion of reading all), the form closes and when it is re-open, I can
see that the cursor
starts moving from record to record without sound by itself.
3. Any possiblibility that I use another method code with the help of Timer
interval, so that the
cursor does not move, and if I close inbetween then also it has no effect
when the form is
re-opened.
Please advise.
Best regards.
Irshad
after 2 seconds interval
On the Employee Form ( EMpFormA) I add a Label and wrote the following code
(which was earlier
helped by Mr. Dougless Steel answer posted for my question. I modified
little to suit my
requirement, I mean I modified to function so that I can use several
places). It runs perfect.
After clicking the label the curson moves from one record to another and it
reads the name of the
employee after 2 seconds gap. Its ok. BUT the problem is something else
which I have mentioned
after the code below:
Private Sub Label17_Click()
On Error Resume Next
Dim GetTotalEmp As Integer
Dim RunTimeA As Integer
Dim pausetime, start, finish
GetTotalEmp = DCount("[ENamee]", "[EmpCurQA]")
DoCmd.RunCommand acCmdRecordsGoToFirst
Do
SpeakMyText (Me.ENamee)
RunTimeA = RunTimeA + 1
'Below line till loop hold the pause
pausetime = 2 ' Set duration.
start = Timer ' Set start time.
Do While Timer < start + pausetime
DoEvents ' Yield to other processes.
Loop
finish = Timer
'till above
DoCmd.RunCommand acCmdRecordsGoToNext
Loop Until RunTimeA = GetTotalEmp
End Sub
Name of the Table : EmpTab1
Name of the Query : EmpCurQA
Name of the Form : EmpFormA
PROBLEM :
1. Is the code above perfect. OR it may have been written in another way.
2. When I click to run the code, it works ok, BUT when I close the form
inbetween (before
completion of reading all), the form closes and when it is re-open, I can
see that the cursor
starts moving from record to record without sound by itself.
3. Any possiblibility that I use another method code with the help of Timer
interval, so that the
cursor does not move, and if I close inbetween then also it has no effect
when the form is
re-opened.
Please advise.
Best regards.
Irshad