Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Echo Not Working 2

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi Guys,

I want to use echo on/off around my code on a form but after it's complete the screen is frozen and I need to close the database.

DoCmd.Echo True, "Updating..."

docmd."Bit of code"

DoCmd.Echo False, "Done"

I have tried repaint, repaintobject, refresh but nothing works.

Does anyone know a solution or an alternative.

Thanks.
 
What do you think this "echo" code is supposed to do?
 

Hi Majp,

From what I read it was like Modal, and it puts the text down at the bottom or the sceen to let the user see that the code was still running, have I got it wrong?

thanks for your reply
 
It is possible that it exist in VBA, but never used it, never seen it up to now, do you perhaps mix two languages (vba and php) ? Its often used in PHP.
 
You are correct, but normally you turn the echo (screen updating off) before the code runs to avoid screen updates when code runs. But then I did not understand what you were trying to do with repaint, refresh. Not sure what that had to do with turning the echo off.

Here is an example
Code:
Private Sub ID_Click()
  Dim I As Integer
  DoCmd.Echo False, "Processing"
  DoCmd.Hourglass True
  For I = 1 To 1000
    Me.EmployeeName = I & " Test"
    subDelay (1 / 100)
  Next I
  DoCmd.Hourglass False
  DoCmd.Echo True, "Done"
End Sub
Public Sub subDelay(sngDelay As Single)
Const cSecondsInDay = 86400        ' # of seconds in a day.
Dim sngStart As Single             ' Start time.
Dim sngStop  As Single             ' Stop time.
Dim sngNow   As Single             ' Current time.
sngStart = Timer                   ' Get current timer.
sngStop = sngStart + sngDelay      ' Set up stop time based on
                                   ' delay.
Do
    sngNow = Timer                 ' Get current timer again.
    If sngNow < sngStart Then      ' Has midnight passed?
        sngStop = sngStart - cSecondsInDay  ' If yes, reset end.
    End If
    DoEvents                       ' Let OS process other events.
Loop While sngNow < sngStop        ' Has time elapsed?
End Sub

In this demo example I update the text box one thousand times, but to avoid showing that I set echo off and pop up an hour glass.
 
DoCmd.Echo [!]False[/!], "Updating..."

docmd."Bit of code"

DoCmd.Echo [!]True[/!], "Done"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi Majp PHV,

I had it round the wrong way!!!

I read the help page again and it makes more sense to me now.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top