|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Compound If Block
Hi,
This is the code I am tackling: Private Sub Text428_Click() If (Option390 = "1" And Option396 = "1") Then Me.Text428 = (Val(Me.sbwt.Value) / (Val(Me.sbht.Value) * Val(Me.sbht.Value))) * 703 ElseIf (Option392 = "2" And Option398 = "2") Then Me.Text428 = Val(Me.sbwt.Value) / ((Val(Me.sbht.Value) / 100) * (Val(Me.sbht.Value) / 100)) End If End Sub Basically it's calculating Body Mass Index which consists of height (sbht) and weight (sbwt), each of which can be given in either of two units (Height unit can either be Option390 or Option392; Weight unit can either be Option396 or Option398). Text428 is the field of the BMI value When I try to run the action (i.e. click Text428 on the form), I get the following error: Run-time error '2427': You entered an expression that has no value And the line that's highlighted above in the code is pointed out. Any insight? |
|
#2
|
||||
|
||||
|
no line in the code is highlighted.
what line cause that error? |
|
#3
|
|||
|
|||
|
Here's a dumb qquestion: do sbht and sbwt have existing values? If you out a breakpoint there, what do they show? also, how are they declared?
|
|
#4
|
|||
|
|||
|
Compound If block
Sorry I didnt highlight the line that caused the error; it is the second line (counting from the top) starting with the "If" statement
Private Sub Text428_Click() If (Option390 = "1" And Option396 = "1") Then Me.Text428 = (Val(Me.sbwt.Value) / (Val(Me.sbht.Value) * Val(Me.sbht.Value))) * 703 ElseIf (Option392 = "2" And Option398 = "2") Then Me.Text428 = Val(Me.sbwt.Value) / ((Val(Me.sbht.Value) / 100) * (Val(Me.sbht.Value) / 100)) End If End Sub And the sbwt and sbht values will be entered and on click of Text428, I would like BMI to be calculated in the field Text428 |
|
#5
|
||||
|
||||
|
what are Option390 and Option396? where are they defined?
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Compound If Block |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|