I have a code that works fine for 4 fields with zero or grater values. Now, I would like to extend this code to check more fields including null values. And if the values of that field is greater than zero then the results should have all the field names concatenated. background: I have different test performed each day. On a given day we only test 13 targets at the maximum so I am trying to automated the results based on the values.
Some field names are like m1, m2, m3 , td1,td2, me1, ad1, ad7, ad14,rs1, ev1, ev2, pv1, pv2,rp and soon ( about 32 different fields).
Only for some fields we need to check all the 4 fields ( m1,m2,m3 rp) to finalize the results
m1_ct |
m2_Ct |
m3_Ct |
td1_Ct |
ad1_Ct |
rp |
TestNo |
Results |
Final |
0 |
24 |
0 |
0 |
0 |
12 |
Test 1 |
Repeat |
0 |
0 |
0 |
0 |
0 |
0 |
13 |
Test 1 |
negative |
1 |
24 |
25 |
23 |
0 |
0 |
25 |
Test 1 |
m1, m2, m3 positive |
1 |
0 |
0 |
0 |
12.3 |
16 |
23 |
Test 1 |
td1, ad1 positive |
1 |
12 |
23 |
25 |
0 |
0 |
17 |
Test 1 |
m1,m2,m3 positive |
1 |
I am just giving one scenario. Not sure if that is possible. Any one have any thoughts or better solution.
Current code
HTML Code:
Public Function FinalResults(fd1 As Double, fd2 As Double, fd3 As Double, fd4 As Double, strTestNum As String) As String
'fd1 is m1_ct, fd2 is m2_ct, fd3 is m3_ct, fd4 is Rp strTestNum is TestNo
On Error GoTo Err_FinalResults
booFinal = False
Select Case True
Case fd1 = 0 And fd2 = 0 And fd3 = 0 And fd4 > 0
FinalResults = "m1 m2 m3 Negative"
booFinal = True
Case fd1 > 0 And fd2 > 0 And fd3 > 0 And fd4 > 0
FinalResults = "m1 m2 m3 Positive"
booFinal = True
Case fd1 = 0 And fd2 = 0 And fd3 = 0 And fd4 = 0
FinalResults = "Invalid"
booFinal = True
Case (fd1 = 0 Or fd2 > 0 Or fd3 > 0) And fd4 > 0 And strTestNum = "Test 1"
FinalResults = "Repeat"
booFinal = False
Case (fd1 > 0 Or fd2 = 0 Or fd3 > 0) And fd4 > 0 And strTestNum = "Test 1"
FinalResults = "Repeat"
booFinal = False
Case (fd1 > 0 Or fd2 > 0 Or fd3 = 0) And fd4 > 0 And strTestNum = "Test 1"
FinalResults = "Repeat"
booFinal = False
Case (fd1 = 0 Or fd2 > 0 Or fd3 > 0) And fd4 > 0 And strTestNum = "Test 2"
FinalResults = "Inconclusive"
booFinal = True
Case (fd1 > 0 Or fd2 = 0 Or fd3 > 0) And fd4 > 0 And strTestNum = "Test 2"
FinalResults = "Inconclusive"
booFinal = True
Case (fd1 > 0 Or fd2 > 0 Or fd3 = 0) And fd4 > 0 And strTestNum = "Test 2"
FinalResults = "Inconclusive"
booFinal = True
Case (fd1 = 0 Or fd2 > 0 Or fd3 > 0) And fd4 > 0 And strTestNum = "Test 3"
FinalResults = "Inconclusive"
booFinal = True
Case (fd1 > 0 Or fd2 = 0 Or fd3 > 0) And fd4 > 0 And strTestNum = "Test 3"
FinalResults = "Inconclusive"
booFinal = True
Case (fd1 > 0 Or fd2 > 0 Or fd3 = 0) And fd4 > 0 And strTestNum = "Test 3"
FinalResults = "Inconclusive"
booFinal = True
End Select
Exit_FinalResults:
Exit Function
Err_FinalResults:
MsgBox Err.Description & ". Procedure: FinalResults"
Resume Exit_FinalResults
End Function
Thank you