Filter subform

  • Thread starter Thread starter Marc
  • Start date Start date
M

Marc

Guest
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
 
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
 
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
 
Forms![frmSearchSubform].Filter = "[suburb] =" & Me.txtSearch
Forms![frmSearchSubform].Requery

that should do it
 
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
 

Users who are viewing this thread

Back
Top Bottom