R
Rock
I have a form that I'm trying to get some 'math' completed via a
command button. I've posted the code below. I have 5 IF statements
(four of which are ElseIF). I've added a msgbox to each to see if the
code is picking up where I would expect. And it is....almost. The
Form lists various items and has a few textboxes. The greater than,
less than numbers in the code reflects an age. So, if age is >=0.1
and <=1.39999 then do this math, elseif, age >1.4 and <=1.9999 then do
this math and so on...all is well, until I get to a record where the
age is between 6 and 13, the last ElseIF....nothing happens when the
button is clicked. If I move to the next record and the age is, say
4, I get the desired result in textbox173. If I move the next record
and the age is 10, I click the button and I get nothing! What am I
over looking? I've tried moving the lines of code up in the list of
if's and elseif's but that did not help...any ideas? (I've added a
commented line: here is my problem in the code to show where the code
seems to stop working!!
Private Sub Command175_Click()
' this code is to populate text173
' empsalary
' range <20k, >20001<=28k,>28001
Dim Sal
Sal = EmpSalary.Value
If (Text57.Value >= "0.1" And Text57.Value <= "1.3") And Sal > 28001#
Then
Text173.Value = Text127.Value * Text89.Value
MsgBox ("Should be x 3")
ElseIf (Text57.Value >= "1.4" And Text57.Value <= "1.9999") And Sal
MsgBox ("Should be x 2.5")
ElseIf (Text57.Value >= "2" And Text57.Value <= "2.9999") And
Sal > 28001# Then
Text173.Value = Text139.Value * Text89.Value
MsgBox ("Should be x 2")
ElseIf (Text57.Value >= "3" And Text57.Value <= "5.9999") And
Sal > 28001# Then
Text173.Value = txb5015.Value * Text89.Value
MsgBox ("Should be x 1.5")
'Here is my problem.....
ElseIf (Text57.Value >= "6" And Text57.Value <= "13.9999") And Sal
MsgBox ("Should be x 1")
End If
End Sub
command button. I've posted the code below. I have 5 IF statements
(four of which are ElseIF). I've added a msgbox to each to see if the
code is picking up where I would expect. And it is....almost. The
Form lists various items and has a few textboxes. The greater than,
less than numbers in the code reflects an age. So, if age is >=0.1
and <=1.39999 then do this math, elseif, age >1.4 and <=1.9999 then do
this math and so on...all is well, until I get to a record where the
age is between 6 and 13, the last ElseIF....nothing happens when the
button is clicked. If I move to the next record and the age is, say
4, I get the desired result in textbox173. If I move the next record
and the age is 10, I click the button and I get nothing! What am I
over looking? I've tried moving the lines of code up in the list of
if's and elseif's but that did not help...any ideas? (I've added a
commented line: here is my problem in the code to show where the code
seems to stop working!!
Private Sub Command175_Click()
' this code is to populate text173
' empsalary
' range <20k, >20001<=28k,>28001
Dim Sal
Sal = EmpSalary.Value
If (Text57.Value >= "0.1" And Text57.Value <= "1.3") And Sal > 28001#
Then
Text173.Value = Text127.Value * Text89.Value
MsgBox ("Should be x 3")
ElseIf (Text57.Value >= "1.4" And Text57.Value <= "1.9999") And Sal
Text173.Value = Text133.Value * Text89.Value28001# Then
MsgBox ("Should be x 2.5")
ElseIf (Text57.Value >= "2" And Text57.Value <= "2.9999") And
Sal > 28001# Then
Text173.Value = Text139.Value * Text89.Value
MsgBox ("Should be x 2")
ElseIf (Text57.Value >= "3" And Text57.Value <= "5.9999") And
Sal > 28001# Then
Text173.Value = txb5015.Value * Text89.Value
MsgBox ("Should be x 1.5")
'Here is my problem.....
ElseIf (Text57.Value >= "6" And Text57.Value <= "13.9999") And Sal
Text173.Value = Txb501.Value * Text89.Value28001# Then
MsgBox ("Should be x 1")
End If
End Sub