Form Loading Speed

  • Thread starter Thread starter Eddy
  • Start date Start date
E

Eddy

I have a form that has a lot of code behind it and even more in a module
that is called when the form loads. Because of the large of fields and code
associated with the form, I assume, it takes a while to load. If I take
the code in the module called from the form and put it in globals module
would it not load when the system starts instead of when the form loads? I
understand it would take longer to start the system but the splash screen
could stay longer and thats a one time delay . I assume this would speed up
the form every time it was opened.

Does this make logical sense or am I way off base or a third alternative is
that I don't know enough about Access to know this won't work.

Any thoughts are appreciated.
 
In all recent versions of Access, modules are loaded the first time anything
in the module is referenced (a call to a sub or function, or a reference to
a public constant or variable), so if you want your module to be loaded when
the application starts something in your start-up form or autoexec macro
must reference something in the module.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Moving the code out of the form is not going to solve anything here.

The fact that you move out 2, or 3 or 5 times the amount of code out of form
into a module is not going to do anything for you.

The amount of code loaded represents a VERY small portion of the forms load
time.

Assuming a disk drive can easily load 30 million charters in 1 second, if
you move out 15,000 characters of code, then you reduced the forms load time
by about (30 million - 15,000), your form now will load in 0.9995


(30 million - 15,000)
---------------------
(30 million) x 1 second = 0.9995

That means you have saved and reduced the amount of characters the form
loads by 15,000. That is in fact 15,000 times less then what the form had
before!! So, 15,000 less characters for the form loading seems like a lot,
but the above grade school math shows that this gives you a saving of about
5 - 10,000ths of a second!!! That is 5 micro seconds!!! - you can't even
measure that amount of time!!

So, clearly, the amount of code you have in the form is not going to really
change anything, and as the above shows, moving out the code is useless.

However, what will obviously change things is the amount of code that
EXECUTES!!! However, once again, code runs VERY fast, and millions of lines
of code can be run on less then 1 second. (and, I doubt you have millions of
lines of code running!!).
I assume this would speed up the form every time it was opened.

As mentioned, you are loading 15,000 less characters into the form..but the
speed up in measured in the 10,000 of a second.
So, you gain nothing really.

The real killers in form load speed is the amount of data you drag into the
form.

You don't mention much details about this form, and thus one really has to
guess as to some speed up solutions.

Are you using sub-forms? If you have a whole bunch of sub-forms behind a
tab, then you can re-write the form to NOT load the sub-forms until you
click on the tab. That means a form with 1 form, or 15 sub-forms will load
at the same speed, since you don't load all those sub-forms. Of course,
without any details as to what your form does...then it is hard to speculate
as to a solution.

So, a few tips:

Loading data into the form is what takes all of the time. You must
concentrate on this issue.

Don't load sub-forms unnecessarily. (are the sub-tables indexed
correctly?).

Same goes for combo boxes, and listboxes...use caution. Any combo that
does a lookup needs proper indexing.

Don't just load a form to a large table, but ALWAYS restrict the number
of records via the where clause
(in fact, you should restrict the form to ONE record).

I find that with small tables, say only 50,000 records, and about 4 or 5
users all working at the same time, you can get away with about 2, or 3
sub-forms, and the form load time is still below 1 second. Any more
sub-forms, then you need to put them behind tab controls..and only load when
the tab is selected.

Make sure your users get a mde, (and, of course turn off track-auto name
correct). And, ALWAYS keep a persistent connection (if you are multi-user).

It is not clear if you are talking about a multi-user setup, and the number
of records you are dealing with. And, it is not clear if you are running a
split database.

Anyway, go thought the following list:.

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

Then start looking at some of the tips I have above, and anything that will
cause un-necessary data to load into the form..as that is the real killer
here..
 
Back
Top