GeoffS Level: VB Lord

 Registered: 29-09-2004 Posts: 640
|
Re: Combo and Text Box
Bit difficult to answer this without knowing which development tools you are using. But since you have posted this in the "Database" Forum I will assume you are using MS Access.
So the ComboBox will contain 3 columns filled with a query against the database table that holds the ServiceType Data -
ServiceTypeID (Column width set to Zero to hide display), ServiceTypeDescription (Column width set to width of Combo to display the description), ServiceTypeUnitCost (Column width set to Zero to hide display), - so when the user selects a ServiceType from the list and fires the Click Event you can retrieve the cost and place it into a variable which you can then multiply by the Detention value in the updown textbox divided by 5 (the value of each increment). The result can then be displayed in a textbox.
Private Sub ComboServiceType_Click()
Dim curServiceTypeCost as Currency
Dim intDetention as Integer
Dim curResult as Currency
curServiceTypeCost = ComboServiceType.Column(2)
intDetention = txtUpDown / 5
curResult = curServiceTypeCost * intDetention
TextBoxResult = Format(curResult, "Currency")
|
____________________________
multi-tasking - the ability to hang more than one app. at the same time.
|