Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open subform filtered

Status
Not open for further replies.

Nacar

Technical User
Dec 21, 2004
21
0
0
US
Hi, everybody.
I have a form with a subform. The form is bounded to tblMonths and has a combobox to find a month. The subform has data with dates. When I open the form, January appears and subform shows all data for January. You change the combobox to June, and subform works good showing data for June. I tried to open the form for the current month (December) and it worked well but the subform still showed data for January. I do not know how to coordinate both AT OPEN.
Please help me.
 
Hallo,

What are your Master/Child link properties for the subform?

and

How do you restrict the contents of the main form after changing the combo box?

- Frink
 
Hi, Frink
The main form is bounded to tblMonths. The subform is bounded to some data with a link to tblMonths thru MonthID. They work well. The main form has only a combobox to choose the month. At open, it shows January and subform shows all January data. If you choose March, subform shows March data. Perfect.
But what I want is that AT OPEN that form and subform show the current month, not January always.
The Master/Child link for both is MonthID.
Thanks
 
Hallo,

To do something when a form is opened put some code in the OnOpen event procedure
You haven't answered my question:
How do you restrict the contents of the main form after changing the combo box?
So I'll assume you have a cboMonth_AfterUpdate event procedure.
In your OnOpen event procedure, set the combo box to the month you want, then call the AfterUpdate procedure, ie.
Me!cboMonth=Month(Now)
cboMonth_AfterUpdate
Should do it, depending how you store your months in the combo box

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top