473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

FIlter form and subform an open form event

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
2 4241
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
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

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

Similar topics

1
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
7
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals....
2
by: TTD | last post by:
Hi, I have a query which is based on a tabel and when I filter on a particular field, Access shows at the bottom 'Field 1 from 20 (filtered)' How can I get this value of the last filtered...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
2
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
0
by: Stinky Pete | last post by:
Hi, The db I'm trying to update has a report form from which all other statistical forms and reports are selected/printed by dept, type, cost, number etc. The report form uses a date filter to...
14
by: Anja | last post by:
Hi everyone, I have a sub form that references a query to get the results. However, what I want to do is filter the results further based on a certain criteria. How can I tell the sub form to...
1
by: Barb.Richards | last post by:
I have created an append query that pulls information from one database, and will append the selected information into a new table. The fields are setup like 'number' 'category' 'code' 'shares' and...
2
by: franc sutherland | last post by:
Hello, I am using Access 2003. I have a query which shows a list of club meetings sorted by date. This query is displayed in continuous forms, in a subform. I would like to select a month on...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.