Not sure why the criterion is repeated (with an OR.)
Presumably tblEmployees.NextReviewDate is indexed.
Date() might be more efficient than Now().
Presumably tblEmployees.Dept is the same data type, and you have a
relationship with Referential Integrity to tblDepartment.DeptID.
You are not doing any sorting in this query, so that's not slowing it
down.
I would be inclined to change the alias to EmpName or FullName or
something,
as Name is know to confuse Access. (In some contexts, it may think you
mean
the name of the form/report rather than the contents of the field named
Name.)
There's nothing in that example that would cause it to run slowly.
Binding the main form won't make it work faster.
Using one subform and changing the SourceObject may still speed it up by
an
order of magnitude if you have 10 subforms.
For other general suggestions, work through the items in Tony Toews'
Access
Performance FAQ here:
http://www.granite.ab.ca/access/performancefaq.htm
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
message
Here is an example of one of the queries I'm using. All 9 of them are
basically the same except that they pull from different tables, etc.
SELECT tblEmployees.ID,
[LastName] & ", " & [FirstName] AS Name,
tblEmployees.NextReviewDate,
tblDepartment.Department
FROM tblDepartment INNER JOIN tblEmployees
ON tblDepartment.DeptID = tblEmployees.Dept
WHERE (((tblEmployees.NextReviewDate)<=Now()))
OR (((tblEmployees.NextReviewDate)<=Now()));
I don't have any LinkMasterFields/LinkChildFields since the main form
is
unbound. If it was bound would that make these load faster?
:
Do the queries include any criteria? Some criteria can use indexes;
others
can't e.g. text fields with leading wildcards can't; vba function
calls
can't.
Also, what's in the LinkMasterFields/LinkChildFields of these
subforms?
Are
these expressions with defined data types, that can use the indexes?
message
Hello Allen,
There were some date/time fields that were not indexed. I corrected
those
and tested it again. It took about 15 seconds to load the form. I'm
using
the
correct data types for my date fields.
What do you mean by designing the criteria so they use the indexes?
:
First thing to do would be to make sure you have indexed your
fields
correctly. For example, if you are filtering on a date/time field,
make
sure
that field is indexed in your table. (Lower pane, in table design.)
Next, make sure the data types are right. For exmaple, if you are
using
Text
fields to store the dates, ...
From there, it might be a matter of designing the criteria so they
can
use
the indexes.
(This all assumes a suitable relational structure.)
There are other workaround. For example, if you only need to see
one
subform
at a time, you may be able to use a single subform control and
change
its
SourceObject rather than load 9 subforms.
message
I have an unbound form that has 9 subforms on it. It loads VERY
slow
and
I
was hoping there was a way to speed this up. All the subforms
load
from
queries but not all of them have data in them since they are all
set
up
with
specific criteria's. Most of them are date driven so depending on
the
current
date will determine if there are records shown in them. Is there
a
way
to
not
load the subforms that don't have any records in them? My DB is
still a
work
in process so it's not split yet. But if the performance is this
slow
for
this form now I can only imagine how slow it will be once I split
it
and
put
it on the server. Any ideas?