Filtering Subforms

andyswinburne

Registered User.
Local time
Today, 15:28
Joined
Sep 29, 2003
Messages
22
Hi,

I have a form with a combo box (CmbTeamSelector) of ID's of teams which is used to filter the from with the ID selected using the code below:

DoCmd.ApplyFilter , "TeamID = " & CmbTeamSelector

I want to use this form as a sub form, but when i try this filter i get the error:

The action or method is invalid becasue the form or report isn't bound to a table or query.

The control sources are correct and the fields are from mixed tables, any ideas?

cheers

Andy
 
Try a main form that contains a combobox fed by the possible teams. Add the other form to this form as a subform. Use the combobox as the criterion for the query that feeds the subform. You can do this using the build functionality. Then on the afterupdate event of the combobox requery the subform.
 
I have the form which filters the records using a combo box which works fine, I want to allow this form to be a subform, but when i do this the filtering no longer works, produces error mentioned above.

I have tried changing the code to Me.Filter instead of the DoCmd which seemed to work occasionally when altering the filter properties of the form, but its not working now and can't remember what ive chaged. I think that the problem maybe that the parent form is not bound to anything?

cheers

Andy
 
thanks very much, didn't realise what you meant first time, works fine.

Cheers guys

Andy
 

Users who are viewing this thread

Back
Top Bottom