Link to home
Start Free TrialLog in
Avatar of m9s999
m9s999

asked on

Problem displaying a status box during a database query

I have an application that pulls data from a large Oracle database. I have a form with various fields the user can enter and a Search button. I would like to display a message telling the user that the program is searching. I have created a form called frmSearchMsg that basically says to please wait. I load frmSearchMsg when the search button is clicked and unload it after the query is finished. The problem is that frmSearchMsg never seems to load complexly. I get the outline and title bar, but the body of the form never loads, i just see what is behind the form. I have tried using the .setfocus and have even put in an empty loop to slow the program down and give it the form time to load, but nothing helps. frmSearchMsg looks fine when I call it by its self. Any Ideas?
ASKER CERTIFIED SOLUTION
Avatar of Shauli
Shauli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prasitlee
prasitlee

Hi m9s999,
    You have a lot of ways to use DoEvents to refresh the menu frmSearchMsg.
    - If you have executed your query program by looping
      Do ......
            ....................
            DoEvents
            ....................
      Loop
      You have to insert DoEvents inside the loop.
   - But if the executed command is just a line of code but it took a long time to query, you have to put Timer Control into your form and set the refresh time on it
     Private Sub Time1_Time()
          ....................
          DoEvents
          ....................
     End Sub
     Hopefully it would be helpful.
                                                     Meng
Avatar of m9s999

ASKER

Calling DoEvents after I show frmSearchMsg seems to fix the problem. Thanks.