Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    15

    Unanswered: vba : stopping a procedure

    Is there some function( like WAIT, SUSPEND or something similar) to stop my current procedure for a few seconds (and let other threads/processes to finish)

  2. #2
    Join Date
    Jul 2004
    Posts
    125
    There isn't a WAIT or SUSPEND function. Here is a (very old and very simple) delay you can call in a procedure. This is one of the first procedures I've written years ago to delay compact and repair procedures to complete and create a copy of the database in early versions of Access. At that time there have been collusions on workstations with a slow CPU and a slow hard drive. You may have to convert the times to Integers Int(). I am curious as to what you need it for.

    Private Function fnTimer(ByVal dblLElapseTime As Double)
    ' 1000 = 1 sec
    Dim dblStartTime As Double, dblTotalTime As Double, lngLoop As Long

    dblStartTime = Timer
    dblTotalTime = (dblStartTime + dblLElapseTime)
    For lngLoop = dblStartTime To dblTotalTime
    If Timer >= dblTotalTime Then Exit For
    Next lngLoop

    End Function

  3. #3
    Join Date
    Aug 2004
    Posts
    15
    Thank you.
    Explanation : When I enter textbox text in it becomes marked and I don't want that so I do
    sendkeys "{F2}" to unmark it, BUT my action is done before text becomes marked(by access) so it takes no effect. That's why I want my "thread" wait while access do his job.
    You are laughing now probably, but I'm just a begginer in database programming. I am writing application for pharmacy store - that's my diplom work on faculty.
    Thank you, once again.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    If what you mean by "Marked" is the fact that the control text is highlighted once the control has focus then simply use this line of code in the GotFocus event of each TextBox control you are worried about:

    Me.myControlName.SelLength = 0


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •