Closing down a session

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing a database with the Tables on one machine and the Forms etc on
other machines for other users, standard stuff but when a user opens a Form
it takes time for the network to pass the required data. Once the Form is
open, the operatiom is quite fast. In order to speed things up, I want to
open a Form and then (instead of closing it and re-opening it when next
required) I want to set the form "Visible = False". The next time the user
needds to use that particular Form, I just set "Visible = True" and this
should speed things up for the user.
The problem is that I have no real method of tracking what Forms are open
(Visible and not Visible) in any session and I need to close the open forms
before closing every thing down. (or could I just "Docmd.Quit"?) Is there any
way to check if forms are open (Visible or not) and close down whatever might
be open before quiting the session?
Thanks RayC
 
Hi

You could put something like the following in your code before the
docmd.quit:

If CurrentProject.AllForms("tablename").IsLoaded = True Then
DoCmd.Close acForm, "tablename"
End If

James
 
Thanks

I meant to put formname in the example obviously rather than tablename
but hey, I guess you'd figure that one out.

James
 
Don't know if this applies to your situation, but I use a form in the FE
named "frmHidden", which is bound to a table in the BE named "tblHidden". I
use a macro named "Autoexec" which opens and maximizes my mainform and then
opens "frmHidden" -- with the Window Mode set to Hidden. That way there's
always an open link to the BE and my other forms open and populate with data
quickly.

When I close the FE database, Access seems to take care of closing any open
forms that might exist, without me having to intervene.

Mark
 
Hi

This concept sounds vey interesting though I think I am just too greenwhen
it comes to Acces to manage to get the whole thing working. I will keep the
idea in mind and try to play with methods of getting it working. Do you have
any code you feel you could share?

Thanks for your input.

Regards RayC
 
Hi RayC,
This approach doesn't involve any code.
I just created a table in the backend database which has one field -- which
I called "Field1" and made this field a text field and made this field the
primary key. I opened this table and entered one record by typing in the
text: "Always_open". (any text would work). So, there's a table in the
backend database with one record.

In the frontend database -- the one that each user uses, I linked to this
table. I then created a new form, choosing the table I had just created and
linked to as the record source. I added the only field listed in the field
list ("Field1") to the form and then saved the form as "frmHidden".

I then created a macro, which I saved as "Autoexec". This macro has 5
Actions:
Echo -- no
Open Form -- "MyMainMenu"; Window Mode: Normal
Maximize
Open Form -- "frmHidden"; Window Mode: Hidden
Echo -- on

When the frontend database opens, it automatically runs any macro named
"Autoexec". This macro then opens the main menu ("MyMainMenu"), plus opens
and hides the form which is linked to "tblHidden". This form ("frmHidden")
remains open (and hidden) throughout the session. The Echo-- no, Echo--on
Actions simply keep the screen from flashing as the forms are opened.
Everything closes on it's own when the frontend database is closed by
whatever method the user uses to close the database.

Please respond if you need additional info.
Also, if more experienced users have suggestions, or words of caution
regarding this approach, please step in.
Mark.
 
Hi

This sounds realy great (unles someone else comes back with a reason why it
will not work) I will set that up and try and work with it over the next few
days. Thanks so much for your help and insight.
Regards RayC
 
Back
Top