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

How to convert data in text boxes.. e.g. Liters to gallons

Status
Not open for further replies.

Gustavson

Technical User
Nov 2, 2001
105
US
Here's what I have. A combo box in which you can choose from Liters or gallons. If Liters is selected, I want to display in a seperate text box, what that is in gallons. How do I set up the text box to first recognize Liters and then do the conversion and display result.. Also, if gallons was selected, I don't want any calculation done, but just mirror the data in the text box.... Hope this is enough info..
Thanx
Gustavson
 
I forgot to mention there is a third box in which you enter the quantity of product..
So, Here is a e.g.
user inputs quantity in text box and selects unit in combo box:
100
Liters
displayed in text boxes is quantity and unit(gallons):
21
gallons
 
Put the following in the Control Source of the Result box:
=iif(txtCombo = "Liters", CStr(txtQuantity * .2642) & " Gallons", CStr(txtQuantity * 3.7853) & " Liters")

where txtCombo refers to the Combo box and txtQuantity refers to the quantity box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top