Global Recordset which is always open

S

Souris

I learn that Global Recordset which is always open can improve multi users
performance from here

http://www.granite.ab.ca/access/performanceldblocking.htm

I beleive that it must be connnected when user running the program.
Should I do it in all the forms or any even triggle in the begin of app and
triggle on the close of application?


Your information is great appreciated,
 
A

Albert D. Kallal

You don't need to do this on a form by form basis.


You simply want ONE connection forced open at all times.....
Should I do it in all the forms or any even triggle in the begin of app
and
triggle on the close of application?


do it once at the start....and then on exit...you can close it.....

A good number have reported that you can also open a database object to the
back end, and htat way you donj't have to choose a random table from the
back end to keep open.

eg:

Dim MyDb As dao.Database
Set MyDb = OpenDatabase("path to back end mdb").
 
S

Souris

Are there any application levels event I can do this like OnApplicaitonStart
and onApplicaitonExit or where I can open and close back end database?

Thanks again,
 
J

John W. Vinson

I beleive that it must be connnected when user running the program.
Should I do it in all the forms or any even triggle in the begin of app and
triggle on the close of application?

If your form has a switchboard form that is routinely open, you can just be
sure that it has a link to a table in the backend (or, as suggested, just a
Database object open).

If you don't want a user-visible switchboard form, you can still have a form
that is opened as the default form; it can be set with its Visible property
set to No. It will close when the database closes.
 
A

Albert D. Kallal

Souris said:
Are there any application levels event I can do this like
OnApplicaitonStart
and onApplicaitonExit or where I can open and close back end database?


You can create a macro called autoexec and it will run on startup of your
application. However there's nothing on the shut down side, and I usually
just let the global variables go out of scope when you shut down anyway.

Since virtually all of my applications have some type of startup form, it is
the on load event of that form that will call the usual several hundred
lines of code that every single application I've ever written in MS access
has at startup time.

So it's a good question, as most typical applications will have a
considerable amount of code that does need to be run at startup to set up
the environment, and do the various housekeeping things that modern
applications need at startup.

While you can use the auto executive idea, I just generally have my main
startup form called the code I need via on-load.

As for the shutdown side, you can use the close event of that main form, or
perhaps do what some do, and is load a form and make it invisible, and have
the code run from that on shutdown (close event of that hidden form will run
when you shutdown). On the other hand, as mentioned for the database object,
or record set that you want to close on shutdown, the variables go out of
scope anyway...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top