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

Filter a datasheet using a form

P: 5
hi there,

i need your help for a solution and code (if neccessary), to help me to filter a datasheet using a COMBO BOX.

i have a query, which contain the following example:

NAME | AGE | COURSE ATTENDING
John | 29 | DOSH
Erix | 20 | DOSH
Alex | 20 | CAT
Brat | 21 | CAT
June | 22 | CAT

i need to find out who are the ones attending DOSH or CAT. i have a large database of names and i need a filter (using combo box) to list out the names that are attending these course using access form. is it possible?

can you help? much appreciated.
Feb 23 '10 #1
Share this Question
Share on Google+
4 Replies


100+
P: 109
Do you want the results to display on the form? Or via a report?
Feb 23 '10 #2

P: 5
hi there,

would like it to be displayed on the form. :)

thanks
Feb 23 '10 #3

100+
P: 109
Well, this is what I do when I need the same. Create a textbox on your form and set it's Control Source to be the combobox you are using for filtering. Set it's Visible property to No so it is hidden on the form.

Then, on your query, in the Course Attending field, in the Criteria section set it to be the textbox on that form - it'll be something like
Expand|Select|Wrap|Line Numbers
  1. [Form]![YourFormName]![YourTextbox]
Create a subform on your existing form based on this query. Then, in the After Update event of the combo box you're using, put
Expand|Select|Wrap|Line Numbers
  1. Me.YourSubformName.Requery
and every time you change selection from the combobox, it should update with your filter.

There is probably a more efficient way to do it but that's what I do!
Feb 23 '10 #4

P: 5
thank you hedges98. and sorry for the late reply. :)
Mar 16 '10 #5

Post your reply

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