Filtering a Form

  • Thread starter Thread starter ravindar thati
  • Start date Start date
R

ravindar thati

hello friends, i am using ms access 2003.
i am displaying a table values on a form by form wizard.

i want to filter those values.
suppose i am displaying table that has fields,
1. id
2. name
3. address

suppose i want to display only those values where name = some thing


how can i filter these values?
also i must me able to enter new rows in the form after the filter?

can we do so?
how can i achieve this?

Thanq
 
If you always want to filter them the same way, create a query with the
criteria you want. Then set the Row Source property of the combo to the name
of that query.

If you want to change the filter with code depending on something else, you
can create the SQL statement in code, and assign it to the RowSource of the
combo, e.g.:
Me.Combo1.RowSource = "SELECT ...

Note that if you hide the ID column (make it zero-width) so only the name
and address show, and then filter the combo such that some of the actual
records you stored are no longer in the combo's source query, those rows
will show as blank on your form. Even though they do have something stored
there, Access has nothing to display when you filter the form like that.
(This doesn't happen if it can display the ID number.)

You might also want to consider renaming that middle field. Most things in
Access have a Name property (forms, controls, fields, ...) so Access is
likely to misunderstand what you mean by Name in some contexts. There's
actually quite a lot of names to avoid. Here's a fairly comprehensive list
to refer to when designing your tables:
http://allenbrowne.com/AppIssueBadWord.html
 
thanq for you response.

also can we add additional rows even after the filter.
ie user must be able to enter new rows on the form.

if filter is applied, can we give him access to enter new rows?

Thanq
 
You can additional rows to the combo's RowSource table at any time.

If the forms is bound to the same table as the combo's RowSource, you can
add new records but they won't show in the combo until you requery it.
 
Back
Top