PDA

View Full Version : Solved: Combo Box help....



Mr.G
12-13-2006, 02:40 AM
Could someone help with this.I have the combo box that you can select a material. Then for the different materials you have different property's at different temperature.
How do I make it so that when you select a certain material it will only work and draw info from that specific material property.?

Here's what I got....

Bob Phillips
12-13-2006, 03:10 AM
Replace your form code with this




Private Sub CboxMat_Change()
If Me.CboxTemp.ListIndex <> -1 Then
GetLookupValues
End If
End Sub

Private Sub CboxTemp_Change()
GetLookupValues
End Sub



Private Sub GetLookupValues()
Select Case Me.CboxMat.Value
Case "Sea Water":
TxtDens.Text = Application.VLookup( _
Val(CboxTemp.Value), Range("D5:F25"), 2, False)
TxtVisc = Format(Application.VLookup( _
Val(CboxTemp.Value), Range("D5:F25"), 3, False), ".000000")
Case "Water":
TxtDens.Text = Application.VLookup( _
Val(CboxTemp.Value), Range("H5:J25"), 2, False)
TxtVisc = Format(Application.VLookup( _
Val(CboxTemp.Value), Range("H5:J25"), 3, False), ".000000")
Case "Oil":
TxtDens.Text = Application.VLookup( _
Val(CboxTemp.Value), Range("L5:N25"), 2, False)
TxtVisc = Format(Application.VLookup( _
Val(CboxTemp.Value), Range("L5:N25"), 3, False), ".000000")
End Select

End Sub

Mr.G
12-13-2006, 06:35 AM
Thanx works 100%