Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening Hidden Forms

    At startup I Open and Hide a few of my more frequently used forms for perceived speed of access. After accessing a form and on closing, I Hide the form again. When the form is next accessed through a search, it opens very quickly, that's good, what I don't like is while the data is being gathered (and this can take some time), the old data is displayed. It's just not very elegant. Does anyone have a better solution? [img]/w3timages/icons/crazy.gif[/img]

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Opening Hidden Forms

    Brian,

    You can always set the screen echo off until the right record is loaded. However, there are a couple of other methods that I use.

    I prefer not to keep forms open unless they're being used to pass values to other objects or code. What I do is open bound data entry forms without a record loaded. They open fast an only get populated when I know what record the user wants or needs. This also avoids users accidentally changing data or otherwise mangling a record. The trick to opening the form this way is to set the recordsource to an expression that always evaluates to false, i.e., SELECT * FROM MyTable WHERE 1=2. As soon as the engine sees the Where clause, it loads the form with an empty recordset based on MyTable. Then, I use some kind of finder to allow the user to specify the record they want to see and I set the recordsource of the form to return that record, and only that record. Without a whole table or query behind it, the form loads the record quickly and the user is limited in the damage he can do. [img]/w3timages/icons/grin.gif[/img]

    The other method involves opening the form from another form, but opening it hidden and either setting its recordsource from the calling form or setting its filter property. Then all I have to do is use DoCmd.SelectObject to make the form visible with the record or recordset I want.

    A variation on the second approach is to use a module level form variable in the first form declared using the WithEvents keyword when opening the second form. That allows you to actually trap and control events on the called form and do something in the first form based on events in the second. You can find samples in help (yes, even Access 2000 help) if you look into using the WithEvents keyword.
    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening Hidden Forms

    Thank you Charlotte: I like all of these suggestions. I believe the second will likely be the best option for me. I'll report back. Thanks again. [img]/w3timages/icons/smile.gif[/img]

Posting Permissions

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