Hi all!
Hope somebody can help me with this.
I have given the Code below. I am trying to increase a varible in loop based on condition and case with 1 or 0.50. For some reason, AmtRP is not increasing by 0.50. It goes to that line of code but it will not increase it by 0.50. If I change the value to say 4 it will increase the AmtRP but not 0.50. I don't have problem with AmtPd and AmtNpd, they do increase by 0.50. Can somebody please look at the code and let me know what I am missing.
I appreciate any help on this. Thank you,
Public Sub CalcAMT()
'determine amount type and add to appropriate bucket
Dim AmtPd, AmtNpd, AmtRP As Integer
Dim AmtFld, TOTFld As Object
Dim fldno As Integer
AmtPd = 0
AmtNpd = 0
AmtRP = 0
For fldno = 1 To 16
Set TOTFld = Me.Controls("TOTD" & fldno)
Set AmtFld = Me.Controls("AMTD" & fldno)
If TOTFld = 0 Then
If Not IsNull(AmtFld) Then
Select Case AmtFld
Case "P"
AmtPd = AmtPd + 1
Case "NP"
AmtNpd = AmtNpd + 1
Case "AH"
AmtRP = AmtRP + 1
End Select
End If
Else
If Not IsNull(AmtFld) Then
Select Case AmtFld
Case "P"
AmtPd = AmtPd + 0.5
Case "NP"
AmtNpd = AmtNpd + 0.5
Case "AH"
AmtRP = AmtRP + 0.5
End Select
End If
End If
Next fldno
Me.TotAmtPd = AmtPd
Me.TotAmtNP = AmtNpd
Me.TotAmtRP = AmtRP
End Sub
Hope somebody can help me with this.
I have given the Code below. I am trying to increase a varible in loop based on condition and case with 1 or 0.50. For some reason, AmtRP is not increasing by 0.50. It goes to that line of code but it will not increase it by 0.50. If I change the value to say 4 it will increase the AmtRP but not 0.50. I don't have problem with AmtPd and AmtNpd, they do increase by 0.50. Can somebody please look at the code and let me know what I am missing.
I appreciate any help on this. Thank you,
Public Sub CalcAMT()
'determine amount type and add to appropriate bucket
Dim AmtPd, AmtNpd, AmtRP As Integer
Dim AmtFld, TOTFld As Object
Dim fldno As Integer
AmtPd = 0
AmtNpd = 0
AmtRP = 0
For fldno = 1 To 16
Set TOTFld = Me.Controls("TOTD" & fldno)
Set AmtFld = Me.Controls("AMTD" & fldno)
If TOTFld = 0 Then
If Not IsNull(AmtFld) Then
Select Case AmtFld
Case "P"
AmtPd = AmtPd + 1
Case "NP"
AmtNpd = AmtNpd + 1
Case "AH"
AmtRP = AmtRP + 1
End Select
End If
Else
If Not IsNull(AmtFld) Then
Select Case AmtFld
Case "P"
AmtPd = AmtPd + 0.5
Case "NP"
AmtNpd = AmtNpd + 0.5
Case "AH"
AmtRP = AmtRP + 0.5
End Select
End If
End If
Next fldno
Me.TotAmtPd = AmtPd
Me.TotAmtNP = AmtNpd
Me.TotAmtRP = AmtRP
End Sub