How to use a calculated value from one form in another form?

T

tom

I have a value on formA text box

=sum(cost)

I want to use this value in formB that I open from formA.

How do I reference this text box in formB?
 
G

Guillermo_Lopez

I have a value on formA text box

=sum(cost)

I want to use this value in formB that I open from formA.

How do I reference this text box in formB?

FormName!ControlName!Text
 
T

twestman

I have a value on formA text box

=sum(cost)

I want to use this value in formB that I open from formA.

How do I reference this text box in formB?

I use an event in the "on open"

Me.[FormBBoxname] = [Form]![FormA]![FormABoxname]

or you could set the default value = [Form]![FormA]![FormABoxname]

I am Tom Too!
 
T

tom

For example in formB, I have a function call

function(a,b,=[Forms]![formA]![TextBoxName])

I think this is not working.

Dennis said:
=[Forms]![formA]![TextBoxName]

tom said:
I have a value on formA text box

=sum(cost)

I want to use this value in formB that I open from formA.

How do I reference this text box in formB?
 
J

John W. Vinson

I have a value on formA text box

=sum(cost)

I want to use this value in formB that I open from formA.

How do I reference this text box in formB?

You don't need to do so. Just recalculate it based on the data in the table.
That will be just as fast as having the form do the calculation, or much
faster if it's necessary to open FormA.

If you *KNOW* that FormA will be open, and you *KNOW* that it will be
positioned at the right record, you can use

=Forms!FormA!Controlname

as the control source of a textbox on FormB.
 
J

John W. Vinson

For example in formB, I have a function call

function(a,b,=[Forms]![formA]![TextBoxName])

I think this is not working.

Leave off the = sign; that's needed when you're using the expression as the
control source of a textbox (to tell Access that it's an expression), but it's
incorrect syntax in a function parameter.
 
T

tom

I am using a recordsource for the new form that does not
have the data to do the calculation. I would prefer your
method, but I am not quite sure how to do it.
 
J

John W. Vinson

I am using a recordsource for the new form that does not
have the data to do the calculation. I would prefer your
method, but I am not quite sure how to do it.

Does the data to do the calculation exist in your tables?

If not, is it user input on FormA and only there?

What IS the calculation, and why do you need to do it on two different forms?
 

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

Top