referring to a text box on a subform from another form.

G

Guest

Howdy from Oklahoma!

I am new to ACCESS and know very little about VB but i am learning as I go.

Now my delima, I have a Form (FormA)that has a text box that needs to have
its "Default value" set to equal that of an opened subform (FormB)that is
part of a tabbed form (FormC). When I originally built the subform (FormA)
and FormB outside of the tabbed form (FormC) it worked great. But now that I
have placed FormB into the Mainform (FormC) under a tab, FormA gives the
"#Name?" error on the textbox that has its Default Value
=[Forms]![FormB].[textbox]. Remember: FormB is now a subform of FormC.

I can open the subform FormB outside of it being a subform (basically by
itself) and it works fine. Just when its a subform, FormA cannot find the
textbox of FormB.

I hope I explained it right. In a nutshell, I need to know how to make this
statement:
=[Forms]![FormB].[textbox]
point to the "textbox" if FormB is now a subform of FormC.

This may be simple but I have tried:
=[Forms]![FormC].[textbox]
and it did not work.

I would appreciate any assistance!!!
And THANKS IN ADVANCE!!!
 
D

Douglas J Steele

I believe that needs to be

=[Forms]![MainForm]![SubForm].Form![textbox]

(see http://www.mvps.org/access/forms/frm0031.htm at "The Access Web")

Note, too, that [SubForm] above refers to the name of the subform control on
[MainForm]. That may or may not be the same name as the form being used as a
subform. If you add a subform by dragging FormA onto FormB, the subform
control on FormB will be named FormA by default (assuming there isn't
already a control by that name on the form). However, if you add the subform
control yourself from the toolbox (or if there's already a control named
FormA on FormB), the control will be named something like Child1.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


KARL DEWEY said:
Use =[Forms]![MainForm].[SubForm].[textbox]

Chip said:
Howdy from Oklahoma!

I am new to ACCESS and know very little about VB but i am learning as I go.

Now my delima, I have a Form (FormA)that has a text box that needs to have
its "Default value" set to equal that of an opened subform (FormB)that is
part of a tabbed form (FormC). When I originally built the subform (FormA)
and FormB outside of the tabbed form (FormC) it worked great. But now
that
I
have placed FormB into the Mainform (FormC) under a tab, FormA gives the
"#Name?" error on the textbox that has its Default Value
=[Forms]![FormB].[textbox]. Remember: FormB is now a subform of FormC.

I can open the subform FormB outside of it being a subform (basically by
itself) and it works fine. Just when its a subform, FormA cannot find the
textbox of FormB.

I hope I explained it right. In a nutshell, I need to know how to make this
statement:
=[Forms]![FormB].[textbox]
point to the "textbox" if FormB is now a subform of FormC.

This may be simple but I have tried:
=[Forms]![FormC].[textbox]
and it did not work.

I would appreciate any assistance!!!
And THANKS IN ADVANCE!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

set value in subform 4
Filter on Current Record 5
Simple copy values question. 2
Accessing controls on a subform 3
Active Event 2
Form does not go back to calling form 4
form access 1
Determine if form is open 3

Top