Results 1 to 4 of 4

Thread: Screen Freezing

  1. #1
    Join Date
    Dec 2004
    Posts
    37

    Unanswered: Screen Freezing

    I have had this problem a few times and have finally decided to try and get to the bottom of it, if I can.

    I have some code running that can at times take 2 to 3 minutes to run, so I have used a progress bar to show how close I am to finishing.

    The code runs fine, but at irregular times the form with the progress bar loses focus, a window appears in the task bar showing the database name and the screen freezes until the code has finished.

    It has no detremental effect on the code or the database, but looks as though the code has stopped running.

    Has anyone ever come across this and found a solution.

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Are you managing the Progress Bar? Or is it being done by Access? If you are then you can use DoEvents ever once in awhile to allow Access to update the screen.

  3. #3
    Join Date
    Dec 2004
    Posts
    37
    I am managing it by sending it a number refering to the percentage.

    I have never used DoEvents is it a command that is worth researching?

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    The DoEvents function allows for other Windows applications and current program processing to continue (including inline events) while code is sequenced. Most often used in looping code of some form or another. Sometimes, it is necessary to allow for other events to update (keep current) of what is going on or being processed.

    You may sometimes find that code will over-run or get ahead of itself. For example. You may open a form and immediately after the code line that opens the Form, you have a line that accesses the Form. It may sometimes fail simply because the form is not fully loaded yet due to other heavy processing in the backgound when the second line fires. Keep in mind, this is just a scenario. The DoEvents can assist you here. For example:

    Instead of:

    DoCmd.OpenForm "Customers"
    Msgbox Forms!Customers.CustomerName

    You would use:

    DoCmd.OpenForm "Customers"
    DoEvents
    Msgbox Forms!Customers.CustomerName

    It may very well solve your problem, but, be carefull how and where you use it. You may not get the results you seek. Well worth researching my friend.


Posting Permissions

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