HELP: Filtering Forms

S

Steve A

Hi,
I have a form (FilterCards) which has a continuous form setup, thus showing
all my records in a table (Cards).

The form is made up of...

ID Name Price Category Location

However Category and location are combo boxes which link to a related field
on category and location tables respectively.

This is all working fine, but now I want to add a combo box and a button in
the header of the form so that I can choose a location from the header combo
then click on the button to filter the form by the value of the combo box.

I want to have the combo box referencing the same as the location within the
body.

Is this possible? If so, how?

Thanks in advance.

Steve A
 
S

Sprinks

Hi, Steve.

Use the same Row Source as your bound combo box, but leave it unbound in the
header. Then use its AfterUpdate event to apply the filter:

Me.Filter = "YourField = " & Me!YourHeaderComboBox
Me.FilterOn = True

If the Combo Box' Bound Column is a text field, you will have to delimit it
with single quotes:

Me.Filter = "YourField = '" & Me!YourHeaderComboBox & "'"
Me.FilterOn = True

Hope that helps.
Sprinks
 
S

sunberries

Hi, I'm working on the same event for a combo box named [Combodate], I wanted
this combo box to filter a continuous form using a data field. I placed thios
combo box on the Header and used a Getfocus and ApplyFilter macro where the
setting for the macro was:

Afterupdate, Get Focus : [Date]
Apply Filter, Where Condition: ([Date]=[ComboDate])

But this setting kept popping out an "Enter parameter value" box - which i
have to type in the value even though I selected it from the combo
already.....

So I tried this Event Procedure from this thread, but now I get a" Runtime
Error 2448, ..you cant assign a value to this object" , and when I debug, I
get a higlighted
" Me.Filter = "Date = " & Me!Combodate
 
Top