Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Slow queries opening form (A2003)

    I have an unbound form that is processing mail merges (1 to Word and 1 to Outlook). As it loads it runs 2 SQL queries and feeds the results into 2 tables ready for the merge, counts the tables and shows the results in 2 text boxes.

    This takes several seconds. I would like the form to open before doing the queries so that the user is not left with the previous form, but I can't find which event to tie the code to so that it runs after the form opens.

    David

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Slow queries opening form (A2003)

    Does it help if you insert a line

    Me.Repaint

    before the code that runs the queries?

  3. #3
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Slow queries opening form (A2003)

    Hi Hans

    No discernable difference. By the way, I should have said I was using the On Current event.

    David

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Slow queries opening form (A2003)

    Try putting the Me.Repaint line in the On Open event of the form.

  5. #5
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Slow queries opening form (A2003)

    That also does not appear to do anything. I tried following it in the On Open event with a MsgBox and it appeared ... but not the form. There surely must be some point in the sequence of things where one can say that a form is visible.

    I'm going to try to put a timing delay in to see if that gets the form to appear.

    Regards

    David

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Slow queries opening form (A2003)

    Have you tried the OnLoad event of the form?

  7. #7
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Slow queries opening form (A2003)

    Hello Pat

    Sorry, On Load also doesn't work. I have experimented with some code I found a long time ago on the MS website. It uses a timer to create a delay between opening the form and running the queries. I've found that the delay can be the minimum 1 millisecond (I think thats the unit) its sufficient just to have a delay.

    This surely can't be the answer, but heck it works.

    Thanks again to you and Hans.

    David

Posting Permissions

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