Results 1 to 8 of 8
  1. #1
    tuna is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    21

    Before query event when opening form

    Hi, is there any event that fires before the underlying queries of a form run when it is opened for the first time?



    I have a form based on a fairly complex query that takes around a minute to run, and I just need to reassure the user that the application has not crashed (as users of little patience often conclude). Preferably, even a status bar or an "x% complete" message would be better but since no timer events run during the querying process I have no idea how to time the querying process.

    I would also like to apply this to subforms which take a long time to query too.

    Thanks.

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    A simple thing to do would be to just turn the hourglass to false while the queries are running, so the users know that they are still running.

  3. #3
    tuna is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    21
    Thanks, but I don't quite follow. I'm considering the situation when a user opens a form from the navigation bar and Access just sits there for a minute or so as the queries underlying the form run, making the user wonder if the database has crashed. Even a simple message box as the form launches would suffice, but it appears that none of the form's events execute before all the form's (and indeed subforms') querying has completed, so there's no event I can rely on to display such a message.

    Also, for some forms I have subforms embedded in a datasheet parent form (i.e. those subforms which expands and contracts as you click the [+] or [-] buttons respectively at the left side of the parent form by the record selectors). When you click the expand [+] button, the form loads but again the underlying queries can take a long time. As before, I would like to notify the user to be patient, but I can't figure out which form event to use to display the message. The subform's "On Enter" event only fires after the subform's queries has run and I can't see any event that corresponds to the expansion of the subform as the user clicks the [+] button.

  4. #4
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    If you have the queries running when the form opens thens you can just do something like

    MsgBox "Queries processing. This make take several minutes"
    'Code to run your queries here.
    MsgBox "Queries finished processing"

  5. #5
    tuna is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    21
    Thanks but I think you've misunderstood my point. The queries that are causing the problem are those ones that underly the form. It wouldn't be a problem if I could run the queries at my discretion via VBA. The issue is that these queries are initiated by access as the form opens, before the form's events are active.

  6. #6
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Are you saying that you don't want them triggering on the form's open event? You want to have something like a command button where you can choose when they are triggered?

  7. #7
    tuna is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    21
    No, what I mean is that I have no control of when the queries are run. They are determined by Access, which runs them when the form is opened, but before the actual GUI of the form is loaded. This is because these queries are the recordsource of the form.

    Hence I have a period when Access appears to crash, before the form finally appears a minute later. Thanks.

  8. #8
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    You always have control of when the queries are ran as long as you have access to the modules and design views. I'm assuming that this is some type of form to display information and not data entry. A few questions.

    Is this data static that is being pulled from an external data source?
    Is the information updated frequently or is it more along the lines of on a daily basis?
    Is the data queried often?

    If it's a case of anything above, I would suggest running a function to have the data written to a table, so the users are not having to query multiple record sources, which can prove time consuming. With the data in the table, it will run much more efficiently.

    If you could provide me a little more background on it, I can try to offer a better solution then just having a notification for the user letting them know it's running.
    Quote Originally Posted by tuna View Post
    No, what I mean is that I have no control of when the queries are run. They are determined by Access, which runs them when the form is opened, but before the actual GUI of the form is loaded. This is because these queries are the recordsource of the form.

    Hence I have a period when Access appears to crash, before the form finally appears a minute later. Thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 03-11-2010, 02:11 AM
  2. Replies: 3
    Last Post: 02-19-2010, 04:19 PM
  3. Replies: 7
    Last Post: 12-24-2009, 08:44 PM
  4. Form does not update after event
    By pedro in forum Forms
    Replies: 10
    Last Post: 12-23-2009, 07:54 AM
  5. Form Event Question
    By protean_being in forum Forms
    Replies: 3
    Last Post: 05-06-2008, 10:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums