By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 1,910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Need help on forms and filters

P: 1
Hi,

I am new to VB. I have a db in access03.i generated a query called query1.

my query1 has

A B C D E F fields

but i want to give the user a option to filter the query based on the field A.
Field A has city names in it.So i was trying to generate a form(in design mode) with a combobox(containing the records of A).If user selects say houston,it should display all the records where A contains houston.

I have a problem doing this.I generated the form but once i select the values in combo box ,,it doesnot give me the filtered data.

Please help me
thanks
Jan 11 '07 #1
Share this Question
Share on Google+
3 Replies


P: 2
NTC
You are not in the realm of VB - so don't worry about that.

Not totally clear what you want because you speak of using a form for the user but then also about them doing a query.....If you want to filter the results of a query using a form then in general the Forms Wizard is really able to help you with this.

Create a new form and select the Form Wizard option and source the new form on your query - - let it do its thing in setting it up and don't worry about layout for now.

When the Form wizard has made it; then put the form into Design View and add a header to the form. Drag a combobox into the header and the combobox wizard will launch - it will prompt you as to what it should be sourced on i.e. field A - and will also prompt you as to whether you want the combobox selection to find the record for the form......

On the other hand if you want to use this form to generate a new query it is a different approach....create a new form that is not sourced on anything i.e. unbound... You can add the combobox for the field A pull down, and unbound blank text boxes for other criteria of the query. Use these values from these unbound controls as criteria in your query - and put a button on your form that triggers the query to run.....
Jan 11 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Hi,

I am new to VB. I have a db in access03.i generated a query called query1.

my query1 has

A B C D E F fields

but i want to give the user a option to filter the query based on the field A.
Field A has city names in it.So i was trying to generate a form(in design mode) with a combobox(containing the records of A).If user selects say houston,it should display all the records where A contains houston.

I have a problem doing this.I generated the form but once i select the values in combo box ,,it doesnot give me the filtered data.

Please help me
thanks
In the criteria of Field A put

[Forms]![FormName]![ControlName]

Of course you substitute the FormName with the name of your form and ControlName with the name of the Combobox. The form must remain open while this query runs.

Mary
Jan 12 '07 #3

NeoPa
Expert Mod 15k+
P: 31,186
Both NTC & Mary have provided answers here (both are good too btw). If you want to get a better feel for what Access can do for you, go through NTC's answer and see what it (the wizard) can do for you. Sometimes you see something in there you're completely unaware of.
Good luck.
Jan 12 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.