Control Source Of Text Box

Evagrius

Registered User.
Local time
Today, 00:01
Joined
Jul 10, 2010
Messages
170
Please delete.
 
Last edited:
Sounds like a syntax problem.
You need the name of the subform control, (not the name of the subform inside it).
Try
=Me.[SubformControlName].Form.[ControlName]

Note: replace my object names with yours.
If you have spaces and/or odd characters in your object names, you will need the square brackets as I have shown above.
 
Thanks Jeanette . . I requested to delete the post becuase I thought I found a similar thread answered by Bob . . it ended up not working though. It worked when I was in the db, but when I closed and reponed, I got the error again. . . . .
 
I tried the EVAL function but that didn't work either . .
 
Sounds like a syntax problem.
You need the name of the subform control, (not the name of the subform inside it).
Try
=Me.[SubformControlName].Form.[ControlName]

Just a reminder that you can't use ME within control sources. That is VBA and control sources do not use VBA syntax. It would be

=[SubformControlName].[Form]![ControlName]
 
I tried that Bob - but for some reason when I close and reopen the db, the textbox in the main form seems to lose connection with the one in the subform . . .any suggestions?
 
1. Did you save the form explicitly. If you open up the form in design view is the same reference there?

2. When you change anything in design view and then close the form does it prompt you to save?

3. What is the exact text of the control source you are using?

4. Is the text box on the subform bound to a field and if so, is the name of the text box the same as the field it is bound to? If so, change the name of the text box.
 
Hi Bob,

The formula in the control souruce of the textbox in the main form is

=[Forms]![Date xx, yy]![txtMax_Stop_Dte]

the name of the textbox in the sub form is txtMax_Stop_Dte

Do you spot an error?
 
Bob - I just tested something that may give us insight. If I open the sub form seperatly, then open the main form, then the formulas work. If I open the main form by itself, even though the sub form is included in the main form, the formulas don't work. Why is this? How can I fix it?
 
First of all, why do you have a comma in an object name? Why is the subform control (not subform, but subform control) named Date xx, yy? That is not a good naming convention and can only cause problems.

Second, you have a bang where there should be a DOT

And third, you don't use [Forms] when referring to subforms. I told you USE THE METHOD I showed here to get the correct syntax:

http://www.btabdevelopment.com/ts/refer2sfrms

You need to open the Main form and then use the builder to go through the main form and to the subform (don't go directly).
 
Last edited:
Bob - I never think the wordThank You is sufficient for what you do. Your tutorial was perfect!! Thank you my friend :)

Also, the db was not my own, I just received it today. Even though I am a beginner I know enough not to revert to flawed naming erros!!

Thank You!
 
I just built it using your tutorial and that did the trick :) I was so happy I ddidn't even look at it yet :)
 
I was just wanting to see what the final result was, if you don't mind posting it.
 

Users who are viewing this thread

Back
Top Bottom