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

Displaying a calculated control from a subform onto another main form

Status
Not open for further replies.

ngoz1

Programmer
Apr 19, 2002
19
GB
Hi,
Could someone please tell me how to display a calculated value in a subform control onto another main form.
By 'another main form' i mean, a main form that is NOT the main form of the subform in question. (I already know how to do that).

Thank you
ngozi
 
Lets give some things some names - to make it clear

Main Form = frmMain
SubForm ( in frmMain ) = frmsubMain
TextBox containing calculated data = txtCalculated
NOW the big point to Note :-
subForm control ( in frmMain ) = ctlsubMain
Now this subform control CAN be the same name as the SubForm that it contains ( and if you use the Wizard to insert the control it WILL be ) however it doesn't have to be. I make it different here so that you can clearly see which one is being used.

Target Form ( where the info is to go ) = frmTarget
Text Box control on frmTarget = txtTarget


So in the Control Source of txtTarget we put the clever stuff !


txtTarget.ControlSource = Forms!frmMain!ctlsubMain.Form!txtCalculated


Explanation
Forms Tell Access you are using the Full description
!frmMain Tell Access which Form
!ctlsubMain Tell access which CONTROL on the form to look at
.Form Tell Access to treat the control above as a Form in its own right
!txtCalculated Tell Access which control on that .Form

QED.


'ope-that-'elps.










G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Thanks for replying little smudge,
I have tried using the full formula the way you explained, but its still not working

but can you explain a bit more, what the difference is b/w txtCalculated and
ctlsubMain. i seem to be confusing them and i think that might be were i am getting it wrong.

hope to hear from you soon
 
ctlsubMain is the NAME of the SubForm control that you drag from the tool box onto the Main form at design time when you designed the Main form.

txtCalculated is the text box control that you draged from the toolbox onto the subForm at design time when you were designing the Sub Form.

The shape and size of txtCalculated will define the shape and size of the text box that cxontains the actual calculated answer

The shape and size of ctlsubMain will define the shape and size of the entire subform as it appears in the Main Form ( regardless of the size of frmsubMain )
You can design a Form that is 10cm wide and 8 cm heigh.
If you then put that into a subform control on your main form and make the subform control only 5cm wide and 4cm heigh then when you view the Form you will only see a little bit ( a quarter ) of the subForm in the subFormControl window.



'ope-that-'elps.



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top