Calculating field values using Combo Box selection

IainG

Registered User.
Local time
Today, 02:27
Joined
May 6, 2009
Messages
25
Can anyone help with this Form issue please.

I have a combo box on my form where the user selects a Currency(cCur) from a query. Each currency record in the query has related exchange rate fields, GBP and USD.
The user also inputs a value(pVal1) that I then want to use in calculating GBP(pVal2) and USD(pVal3) from the related exchange rate in the query.

In the query I have the following fields. ID, Currency, GBP, USD.
On the form I want the following!
Currency = Combo Box Selection.
pVal1 is a user input.
pVal2 = pVal1 * GBP(from query)
pVal3 = pVal1 * USD(from query)

Any help will be very much appreciated!
 
I would bring these three fields into the combo box: Currency, GBP, USD.

You would set the bound field of the combo box to Currency. You can hide the GBP & USD field from the user by setting the column widths property to zero for each.

For your calculations, you can reference the GBP & USD values from the combo box using the following expressions

pVal2 = pVal1 * comboboxname.column(1)
pVal3 = pVal1 * comboboxname.column(2)

Access starts counting the columns of the combo box's row source at zero, so the currency field is column 0, the GBP column is column 1 and the USD is column 2
 
That has worked perfectly! Sorted.
Thank you for the super fast response.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom