By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

FIlter form and subform an open form event

P: 41
Greeting All

I have several public variables which I use to build a filter string that I would like to use when I open a form and several associated sub forms. I have set the value of the combo box on one of the subforms with this variable. I have not yet figured a way to have the update event code on the combo box run automatically, so I put the following code in the open statement of the main subform. Here is some current code:

Me.Filter = "[trYear]='" & Me![Combo46] & "'"
Me.FilterOn = True
This code works and populates subform teacherresources1

Forms!schools1!enrollmentsub.Form.Filter = "[year]='" & Me![Combo46] & "'"
Forms![schools1]![enrollmentsub].Form.FilterOn = True



This code which is pulled from the update event of the of the combo box located on the teacherresources1 form and now placed in the open event of teacherresources1 fails with the following message:
Error 2455 invalid reference to the property form

My question is how to get the combo box to run as the form opens so that all forms are filtered as if I had made the selection from the combo box manually. Thanks for any insight here.

Patti
Tags: ms, access, 2003
Mar 20 '08 #1
Share this Question
Share on Google+
2 Replies


P: 41
Sorry. my head uis turnig to mush today. Here is another example of the code that I misstated.

Forms!schools1!enrollmentsub.Form.Filter = "[year]='" & Me![Combo46] & "'"
Forms![schools1]![enrollmentsub].Form.FilterOn = True


The public variable has been placed in the combo box with the following code:

Me![Combo46].Value = get_holdvar()

Thanks
Mar 20 '08 #2

P: 41
Finally got this to work by duplicating the code I had in the update event of the combo box to the got focus event of the same combo box. When I open the form and navigate to the subform the got focus event kicks in.

Patti
Mar 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.