(Leo) Default Value on a Form

G

Guest

Hi,
I have two controls on a form which showing amounts and a currency feild
showing the type of currency for a transaction.
the first control box shows the amount in booking value in local currency.
the other control box shows the transaction's real currency amount which may
be different from local booking currency amount. I put this phrase on the
default value of the currency amount control;
IIF ([Cur]="Local", [Booking Amount], 0)
which means; if the currency of transaction was the same as "Local", put the
"Currency amount" the same as "Booking Amount", and if not do nothing.
so it didnt work, and the system doesnt respond to this default at all.
what is the problem? should I associate this default value with some other
event?
 
N

Nikos Yannacopoulos

Leo,

This is a timing thing. The default value of a control is calculated /
entered at the time a new record is created, at which time, of course,
you have not had the time to enter a booking amount and currency yet;
consequently, the calculation is carried out on (booking value /
currency) 0/null or null/null, or even 0/Local or null/Local if you
have Local as default value for currency (assuming Access works out the
default for currency before calculating the default for actual value -
which there's no guarantee over, and no way to determine!).
What you need is a simple macro in the booking amonut control's Before
Update or After Update or On Change event, with a SetValue action, and
arguments:
Item: [Actual Amount]
Expression: IIF ([Cur]="Local", [Booking Amount], 0)

where I have assumed the second control to be called Actual Amount (in
the Item argument; change to the actual control name. This will result
in the actual amount being set to the booking amount on every change of
the booking amount, as long as the currency is (has already been set to)
Local.

HTH,
Nikos
 

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