Filtering Subform via a second Combo Box, Then Removing Filter

jalge

Registered User.
Local time
Today, 16:54
Joined
Apr 14, 2003
Messages
24
I have a main form and subform that are already linked/synchronized using a combo box. (When you select an attorney's name on the main form combo box, their timelog records are displayed in the subform. One of the fields in the subform is the client's name.

The users would like a second combo box on the main form that filters the records further by the name of a selected client. How do you set it up so you can select a client to show just those records, then "deselect" a client and show all the records again for that attorney?

I've used the forum's search feature, and can't seem to find exactly what I'm looking for.

Any help would be appreciated.
 
There are a couple of ways to do this. You will need a combo on the subform though to select the clients names - you will need to populate this with the names of the clients relevant to that attorney by setting the criteria in the AttorneyID field (or whatever it is called in yourDb) to grab the current attorney from the first combo ie

=Forms!MainForm!Combo1

On the AfterUpdate event of the second combo (on the subform)

PHP:
if not isnull(me.combo2) then 'client selected'
me.filter = "[ClientID] = " & me.Combo2
me.filteron = true
else 'no client selected'
me.filteron = false
end if
 
Thank You Thank You

That code works great. Thanks much!!!
 

Users who are viewing this thread

Back
Top Bottom