A filter activated from a form

E-D

Registered User.
Local time
Today, 11:07
Joined
Dec 31, 2001
Messages
42
I have a form in which a number of Command Buttons activating a certain query.
the query shows 2 fields: name, statusid
each one of the Cmd Buttons should open the query but with a different status.
I think it would be wiser to use only one general query and use the form's filter. How can I filter my request automatically?
I want the Cmd's to show wanted records filtered by the relevant status automatcaly.


thanks
 
One way is to build a criteria in your query so that it picks up the selection criteria from your form. This is easier if you leave your form open (use minimise). Right click in the criteria section of your query where you want to select. Build. Select Forms, Loaded forms, double click on your form name, double click on the control in which your criteria is selected. You should have syntax like Forms![activity]![contractno]. Click ok. You can also do this to select ranges as below. You must run queries constructed this way from a form unless you want to manually enter the criteria.
>=([Forms]![forex main dates]![fromdate]) And <=([Forms]![forex main dates]![todate])
 
thnaks for your reply, however it does not meet my needs, since in my case this query should be called from different forms.
basically we are talking about a list of names that I want to filter according to a statusid.
Is there any filter option that I can use in my Cmd Buttons or within the code to add
a creteria not to the query itself but to that specific action?
 
Your problem is still not clear to me. I suggest two possible routes 1.If you want to display a simple list of names based on a status control in a form why not make your command button open a form created to view the results of the query suggested in my initial answer or 2. Use a subform within your form linked to the table of names through the status. You will need to create a table of status items from which you create your main form and then insert a subform created from the name table. As you move through the status records your names will be listed for each status.
 
thanks again. your routes are ok, but they
require building another form or more queries with different creterias.
I wish to use one query only while each Cmd Button is filtering the list according to needed statusid.
I dn't want to take the creteria form the form.
I have a frmSuppliers. I want to have 5 Cmd Buttons: one will show Active Suppliers, the second will show external suppliers and so forth. Status of suppliers is categorized by field "statusid". I have a query called qryListOfSuppliers, it shows suppliers' names and status.
now each Cmd Button should use the same query only automaticaly choosing one status only (for example: CmdActiveSuppliers should only show active suppliers).
This query is olso used in other forms and not with this form only.
I'm not willing to create a view of all status kinds but to show the user relevant status only.
Correct me if I'm wrong but your routes do not work for me
I hope I explained it better this time
and I'm sorry to bother you again
thanks
 

Users who are viewing this thread

Back
Top Bottom