BobAlston <bobalston9 (AT) yahoo (DOT) com> wrote in
news:iul5mi$dpj$1 (AT) dont-email (DOT) me:
Quote:
What Rick says seems to make sense as if I open my form using my
usual technique, but then click on the button to remove the
filter, I IMMEDIATLY see the first record of the entire recordset
- no delay. |
I'm not sure I'm convinced by Rick's speculations.
I would say there's a difference between when the filtering happens
in these two cases:
1. a filter defined and saved in the form's .Filter property, such
that it is always applied each time the form opens.
2. a WhereCondition argument of the DoCmd.OpenForm command.
In my experience, the latter happens before the form is opened
(i.e., the filtered records are all that is ever requested), while
the former situation does load the whole form and then the filter is
applied after everything has been loaded.
Because of this, I generally do not use saved filters at all.
The other thing that this makes me think of is when you've got an
ORDER BY defined in the form's OrderBy property -- the same thing
happens. But also, if your form's underlying recordset has an ORDER
BY defined, it can have an effect on how many records are retrieved
(but it depends on what you're sorting on, of course).
Quote:
What I don''t understand is how much of what data is read before
the filter is applied? Indices and if so which? How many
records, enough for the first page, just as would be done if no
filter and then use the filter to process further? |
My experience is that the form with a filter property is much less
efficient than the WhereCondition in the DoCmd.OpenForm command.
Quote:
My question then really deals with whether using a datasource as a
query with a WHERE source would make much difference. I think I
say a posting by Albert Kallal which said the difference would not
be noticable unless you had a large number of records in the
original datasource. My current project has about 18k records and
they are fairly large. |
I would say that you could be as efficient as possible by having
your form have an empty recordsource using the smallest table local
to your front end:
SELECT TOP 1 Null As Field1, Null As Field2, 0 As Field 3
FROM MSysAccessObjects
(I chose MSysObjects because in a virgin database, it has at least 1
record, and of the tables that are guaranteed to have at least one
record, it has the smallest number)
This allows you to have bound controls and not have #Name errors --
it will just show one uneditable blank record. Then you could change
the Recordsource to display any subset of records you like.
In an app of mine that for years used an MDB as the back end (years
after it should have been upsized to SQL Server), I used that
approach, and it worked extremely well, even for the main form,
which loaded data from a table with 250K records in it (and 350K and
600K records in its child tables, i.e., displayed in subforms).
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/