Referencing a control in a sub sub form

  • Thread starter Thread starter Darrell
  • Start date Start date
D

Darrell

How do I reference a control in a sub sub form?

I am trying to set the value of an unbound text box in a
sub sub form to the value of a combo box on the subform
on the Current event of the subform.

The following is my syntax:
"Forms!subfrmSurveyQuestion!
subsubfrmAnswers.txtQuestionNumber = Me.cboQuestionNumber"

On run, I get error 2450 "Microsoft Access can't find the
form 'subformSurveyQuestion' referred to..."

If I use "Me!subsubfrmAnswers.txtQuestionNumber =
Me.cboQuestionNumber" I get error 438, "Object doesn't
support this property of method."

Help!

Thanks!
 
Darrell said:
How do I reference a control in a sub sub form?

I am trying to set the value of an unbound text box in a
sub sub form to the value of a combo box on the subform
on the Current event of the subform.

The following is my syntax:
"Forms!subfrmSurveyQuestion!
subsubfrmAnswers.txtQuestionNumber = Me.cboQuestionNumber"

On run, I get error 2450 "Microsoft Access can't find the
form 'subformSurveyQuestion' referred to..."

If I use "Me!subsubfrmAnswers.txtQuestionNumber =
Me.cboQuestionNumber" I get error 438, "Object doesn't
support this property of method."


The first syntax is incorrect because subforms are not
members of the Forms collection (they are not open in their
own right).

The second syntax is OK, but you must use the name of the
subform Control, which is not necessarily the name of the
form object it is displaying.
 
Thanks for the tip. At least now I know not to use the
full path name when referring to a subform. However, the
second one still doesn't work, even though the name of
the control and the subsubform are the same in this case
(subsubfrmAnswers). Now what do I do?

Darrell
 
Thanks for the tip. At least now I know not to use the
full path name when referring to a subform. However, the
second one still doesn't work, even though the name of
the control and the subsubform are the same in this case
(subsubfrmAnswers). Now what do I do?

You need to "drill down" through all the layers of subforms: from the
mainform, the reference would be

Me!subform.Form!subsubform.Form!controlname


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
I don't know, it looks ok to me.

Are you sure thecontrol names are spelled correctly?

The only other thing is that I prfer the more fully
qualified reference:
Me!subsubfrmAnswers.FORM.txtQuestionNumber =
Me.cboQuestionNumber
 
Back
Top