dbTalk Databases Forums  

Filtering data for a form

comp.databases.ms-access comp.databases.ms-access


Discuss Filtering data for a form in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob Alston
 
Posts: n/a

Default Filtering data for a form - 01-20-2009 , 07:17 PM






Have a form that has a source of approx 9000 records. When I open it, I
would like to open it on a specific initial record, a person's data. I
enter that number as a filter, but leave the data source as the table name.

It results in the form being displayed showing the total number of
records in the table. I expected it would show a total record of 1 and
have "(filtered)" next to the total.


when a user selects a new person, i reset the filter and me.requery.
This time I get a total record count of "1 (Filtered)" which is what I
expected.

Something I am doing wrong?

Bob

Reply With Quote
  #2  
Old   
Rick Brandt
 
Posts: n/a

Default Re: Filtering data for a form - 01-20-2009 , 08:12 PM






On Tue, 20 Jan 2009 19:17:19 -0600, Bob Alston wrote:

Quote:
Have a form that has a source of approx 9000 records. When I open it, I
would like to open it on a specific initial record, a person's data. I
enter that number as a filter, but leave the data source as the table
name.

It results in the form being displayed showing the total number of
records in the table. I expected it would show a total record of 1 and
have "(filtered)" next to the total.


when a user selects a new person, i reset the filter and me.requery.
This time I get a total record count of "1 (Filtered)" which is what I
expected.

Something I am doing wrong?

Bob
Exactly how are you "entering that number as a filter"?

Forms have a Filter property and a FilterOn property. The filter is not
applied until the latter is set to True. Are you doing that?



--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Reply With Quote
  #3  
Old   
Albert D. Kallal
 
Posts: n/a

Default Re: Filtering data for a form - 01-20-2009 , 08:14 PM



I suspect when the form opens up, since the form doesn't have a filter as
yet set on it, then it likely counts the number of records in the table and
displays that. This might be a bit of a quirk, or even perhaps a bit of a
display update issue, of which some might consider a bug.

It is always been my preference in general to suggest that you use the
"where" clause of the openform command when you open up a form to the one
record. While you can use the filter option of the openform command, the
actual filter of a form is of more use when you want to "read" what
filtering options the user has placed on that form by user intervention. So,
if a user interactive uses the menu bar to filter by "selection" for
example, then your code could then "read" the forms me.Filter setting to see
what the critera is.

So,, use of forms filter option is AFTER the forms already been loaded you
are free to change/filter the records the form displays.

However if you're going to load a form to one record, then you should use
the "where" clause when you open the form.

The where clause says these are the only records I want to be loaded into
this form when we execute the openform command.


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal (AT) msn (DOT) com




Reply With Quote
  #4  
Old   
Bob Alston
 
Posts: n/a

Default Re: Filtering data for a form - 01-21-2009 , 05:00 PM



Rick Brandt wrote:
Quote:
On Tue, 20 Jan 2009 19:17:19 -0600, Bob Alston wrote:

Have a form that has a source of approx 9000 records. When I open it, I
would like to open it on a specific initial record, a person's data. I
enter that number as a filter, but leave the data source as the table
name.

It results in the form being displayed showing the total number of
records in the table. I expected it would show a total record of 1 and
have "(filtered)" next to the total.


when a user selects a new person, i reset the filter and me.requery.
This time I get a total record count of "1 (Filtered)" which is what I
expected.

Something I am doing wrong?

Bob

Exactly how are you "entering that number as a filter"?

Forms have a Filter property and a FilterOn property. The filter is not
applied until the latter is set to True. Are you doing that?



I enter it in the form properties as a filter property.
[client_number]= -12345
Allowfilters is set to yes.

bob


Reply With Quote
  #5  
Old   
Bob Alston
 
Posts: n/a

Default Re: Filtering data for a form - 01-21-2009 , 05:11 PM



Albert D. Kallal wrote:
Quote:
I suspect when the form opens up, since the form doesn't have a filter as
yet set on it, then it likely counts the number of records in the table and
displays that. This might be a bit of a quirk, or even perhaps a bit of a
display update issue, of which some might consider a bug.

It is always been my preference in general to suggest that you use the
"where" clause of the openform command when you open up a form to the one
record. While you can use the filter option of the openform command, the
actual filter of a form is of more use when you want to "read" what
filtering options the user has placed on that form by user intervention. So,
if a user interactive uses the menu bar to filter by "selection" for
example, then your code could then "read" the forms me.Filter setting to see
what the critera is.

So,, use of forms filter option is AFTER the forms already been loaded you
are free to change/filter the records the form displays.

However if you're going to load a form to one record, then you should use
the "where" clause when you open the form.

The where clause says these are the only records I want to be loaded into
this form when we execute the openform command.


Thanks Albert. That works.

I had tried using a filter, defined in the form properties (per my just
sent response). allow filters was set to yes.

Your suggestion worked. I allow users to make new selections from a
drop down list box. I then take the key, construct a new filter, and
issue a requery command. This way I only transmit from the back end
only the records related to the selection.

Bob


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.