Filtering a subform from a combo box?

Fantastic! Thanks very much.

The only thing I notice is that you can't clear the filter, so if I want to see all records again, I cant choose * or "All" from the drop down. Is there any way around this?

Many thanks,
NS.

Reason for edit: No longer get the error msg.
 
You can do so in the After Update event of the combo box.
Code:
If Nz(Me.ComboboxName.value, "") = "All" then
      Me.SubformControlName.LinkChildFields = ""
Else
      Me.SubformControlName.LinkChildFields = "[NameOfID]"
end if
 
You can do so in the After Update event of the combo box.
Code:
If Nz(Me.ComboboxName.value, "") = "All" then
      Me.SubformControlName.LinkChildFields = ""
Else
      Me.SubformControlName.LinkChildFields = "[NameOfID]"
end if

Great! You have been a fantastic help!

Thanks,
NS
 
Sorry vbaInet, I have one more question which you might be able to help with if that's ok?!

Your solution worked perfectly. However I'm now thinking that it would be good to give the user a choice of filters to apply. For example I have another column named "Employee" which users may want to filter on. I have tried simply adding a second combo box and adding the appropriate fields to the Master/Child links. This works in a way but not the way I would like. I would liek it to be a choice (Combo box Area Code OR Employee) not one based on the other if you see what I mean!?

Thanks for any help.

-NS
 
Option buttons, Area Code and Employee Name. Use the option buttons to determine which was selected. However, everything now would have to be done in code. Search the forum for how to sql strings using vba.

In addition, here's a tutorial from pbaldy:

http://baldyweb.com/BuildSQL.htm
 
Thanks for that vbaInet. It looks a little out of my league for now. I might delve into VBA at some point in the near future tho!

Many thanks,
-NS
 
Last edited:
I think you're overwhelmed by content. Take things step by step and you will get there. Theres even a sample search form db on there too.

Good luck!
 

Users who are viewing this thread

Back
Top Bottom