Results 1 to 18 of 18

Thread: Form not responding

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    I am having a problem with my form. When I run the program (which does SQL queries on a Jet dbase) it lists in the Task Manager as Not Responding, and the form doesn't refresh (if you open something else and then come back to the form none of the form stuff, redraws.) However, when the code finally finishes the form refreshes. How do I make it stop listing as Not Responding and refresh?

  2. #2
    Guest
    Try placing DoEvents in your code.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    How would I use DoEvents? Put it at the beginning of the cmdButton_Click event?

  4. #4
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    Hi,

    I don't know if this will help in your case, but in the Form_Activate() use the Recordset.Requery statement before your main code, and that way you will refresh the data environment when the form shows.

    GRAHAM

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    DoEvents

    DoEvents commands are usually put inside loops. They give the operating system the chance to do things like repaint the screen that they might not otherwise get the chance to do in a tight loop.

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    My program doesn't use any major loops where a lot of processing occurs. Is there somewhere else I can put the DoEvent statement. Also will I just put DoEvent on its own line, or do I need to assign a variable: MyVar=DoEvent?
    Thanks for the help guys.

  7. #7

  8. #8
    Guest
    I would think that you should place it in your loop that causes the delay.

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    Thanks for all the help guys, I'll try it.

  10. #10

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    One last thing, does DoEvent work for everything after it?
    For example I've got this code in a Click event:
    funcFunction1
    funcFunction2...etc
    If I put DoEvent before the first function call, will it work for all the functions after it?

  11. #11

  12. #12

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    How long of a pause?

  13. #13
    Lively Member
    Join Date
    Jun 2000
    Posts
    82
    The pause caused by a DoEvents command is not really noticeable. Your problem may have more to do with an SQL query which is taking a long time to return control to your application. Is the database you're querying normalized? If you send a query to a large table, your query will appear to freeze the system.

  14. #14
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    the pause depends what threads windows system is executing on it, you may in worst case wait 10 mins, but thats highly unlikely to happen. usually it takes less than a millisecond.

    You can use it in a loop with gettickcount api and you will have a dealy
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  15. #15

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    They are fairly long queries. Is there anyway around this, or do I just have to live with it? Which is fine since it's not for districution

  16. #16
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well that depends on the system, the end users system but if it's for you and you have a problems with it you have to live with it or get a new one.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  17. #17
    Lively Member
    Join Date
    Jun 2000
    Posts
    82
    Can the database you're querying be normalized any more than it is? Querying a small table rather than a large one will save a great deal of time.

  18. #18

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    45
    No, I've already tried to break it into the smallest pieces possible before doing anything major to them. Again thanks for all your help guys.

Posting Permissions

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



Click Here to Expand Forum to Full Width