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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subforms

Status
Not open for further replies.

Legends77

Technical User
Jan 18, 2009
57
US
Question:
How do I do a if statement on a main form to reference a field on a subform?
I.E.
Subform = CP2Criteria
Field in Subform = BeginingMonth
Field on Main form = CP2BM (unbound)
need:
if me.cp2criteria.beginingmonth=1 then
me.cp2bm="April"
else if me.cp2criteria.beginingmonth=2 then
me.cp2bm="May"
etc.....
Problem is that it is saying .beginingmonth is not found

Any help is greatly appreciated.
 
me.NameOfsubformControl.form.NameOfControlOnSubForm

 
What about this ?
Me!CP2BM = MonthName(Me!CP2Criteria.Form!BeginingMonth + IIf(Me!CP2Criteria.Form!BeginingMonth < 10, 3, -9))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Okay, I am getting a tad confused as to what is "NameOfsubformControl", "NameOfControlOnSubForm".
Name of subform: CP2Criteria
Name of Field in subform: beginingMonth
Name of Main form: Group Summary
Name of field in main form: CP2BM

I have tried multiple arrangements and not having any success. Could you perhaps help me clearify what each means so I can better understand?
 
to reference beginningMonth on subform from main form

me.CP2Criteria.form.beginingMonth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top