View Full Version : Filter subform


Marc
01-25-2001, 08:32 AM
Hi,

I have a search form with one text box and one combo box. The combo box contains all of the fields of a table and the text box is where the user enters their search queries.

I also have a subform with all of the records displayed from a table. I want on the click of a button (or anything else) to filter the subform according to criteria given by the user.

I'm totally stumped and any help would be greatly appreciated!

Thanks,
Marc

ntp
01-25-2001, 10:25 AM
lets say you have a command button the user clicks on after they enter their criteria, an ID value or something.

Private Sub Command0_Click()
Forms![YourSubformName].filter "[IDField} = " & me.txtCriteria
Forms![YourSubFormName].requery
End sub

This should apply a filter to your subform then do a requery to update teh subform.

ntp

Marc
01-27-2001, 08:56 PM
Thanks for the reply but it still doesn't work!

This is the exact code I used:
Forms![frmSearchSubform].Filter "[suburb] = " & Me.txtSearch
Forms![frmSearchSubform].Requery

It comes up with this error:
Compile Error:
Invalid use of property.

(And it highlights the word filter)
Any help with this would be great!

Marc

fbt
06-30-2001, 10:03 AM
Forms![frmSearchSubform].Filter = "[suburb] =" & Me.txtSearch
Forms![frmSearchSubform].Requery

that should do it

D-Fresh
07-02-2001, 05:20 AM
You need to specify the Form property first... Try this...


Forms![frmSearchSubform].FORM.Filter = "[suburb] =" & Me.txtSearch
Forms![frmSearchSubform].FORM.Filteron=true

Hope this helps.

Doug