filters on forms

philfer

Registered User.
Local time
Today, 11:30
Joined
Dec 15, 2008
Messages
29
ello,

Has anyone been able to deploy comboboxes as filters on a form satisfactorily.

I have a form with several fields and am trying to use comboboxes as filter. The ControlSources for the comboboxes are the field from the table.

It is easy with one filter. I just set the filter and then filter on

When there are two filters it gets more difficult. I can filter the form by checking if the filter is empty and if it is setting it to the combobox selection and then turning the filter on and if it isnt empty setting the filter to the existing filter "AND" the new filter.

But I run into two problems :-

1) After the first filter I cant get the other comboboxes to only hold the values of the filtered dataset

2) If I then re-filter on the same field it gives no results as it is trying to look at the first filter "AND" the second one which gives a resulting empty dataset

Any ideas???

Cheers
Phil
 
I suggest, try to do it vai FILTER BY FORM, CLEAR GRID, APPLIY FILTER and REMOVE FILTER, icons.
 
Hi there I’m still very new in Access, but after some search I got this

i have the following
- "Tasks" table, contain many fields the two what i use to filter is Category & Status
- table named Categories contain one column contains all Categories
- table named Status contain one column contains all status

i made a form with two combo Boxs
- First Filter by Category
name cboShowCat
row source Categories
event - After update add this Vba code
Private Sub cboShowCat_AfterUpdate()
If IsNull(Me.cboShowCat) Then
Me.FilterOn = False
Else
Me.Filter = "Category = """ & Me.cboShowCat & """"
Me.FilterOn = True
End If
End Sub


- Second filter by status
name cboShowstatus
row source status
event - After update add this Vba code
Private Sub cboShowstatus_AfterUpdate()
If IsNull(Me.cboShowstatus) Then
Me.FilterOn = False
Else
Me.Filter = "status = """ & Me.cboShowstatus & """"
Me.FilterOn = True
End If
End Sub


and walla.. it works fine for me as a beginner.
now I’m trying to develop it.
 

Users who are viewing this thread

Back
Top Bottom