Copy a currency value from one control to another

C

Cbeckwith

I have a text box (called ExtendedCost), that has a sum statement in it. I
want to copy the value on the exit control event to another text box control
(called WithdrawlAmount) on the same form and write the value into
WithdrawlAmount box on the Enter Event for the control box, so people don't
have to input the same number into the control box. Is there an easy way to
do this?
 
J

Jeff Boyce

First a caution ...

You're describing copying the contents of one control into one/more other
controls. As long as you aren't trying to SAVE the value in multiple fields
in underlying table(s), no worries. That is, all those other controls would
be unbound...

In the AfterUpdate event, or the OnExit event from your first control, you
could use something like (untested):

Me!YourSecondControl = Me!YourFirstControl
Me!YourThirdControl = Me!YourFirstControl
Me!Your...

If, however, your other controls are bound to underlying fields in tables,
then reconsider. If you already know/have stored the value one time, what
rationale are you using to store it repeatedly?

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
D

Daryl S

Cbeckwith -

In the Enter event for the WithdrawlAmount control, add this:

If nz(Me.WithdrawlAmount,0) = 0 Then
Me.WithdrawlAmount = Me.ExtendedCost
End If

The if/then is to prevent a previously-entered value from being
over-written. If you want it always to be udpated when the field is entered,
then don't use the If/End If statements.
 
F

fredg

I have a text box (called ExtendedCost), that has a sum statement in it. I
want to copy the value on the exit control event to another text box control
(called WithdrawlAmount) on the same form and write the value into
WithdrawlAmount box on the Enter Event for the control box, so people don't
have to input the same number into the control box. Is there an easy way to
do this?

Regarding .. "to copy the value on the exit control event to another
text box control" ...
That doesn't make programming sense to me.

If the [WithdrawalAmount] value is always the same as the
[ExtendedCost] value and you wish to display that value in a different
text control, then

1) You can simply enter the same [ExtendedCost] control source
expression as it's control source?
or ....
2) You can refer to the [ExtendedCost] value:
=[ExtendedCost]

In either case there is no need to save in any table either the
[ExtendedCost] value nor the [WithdrawalAmount].
 

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