!!!Complicated calculation!!

I have an ADO recordset which holding data from a table. I have 2 more table table named RANGE and GRADE.

Now what I want is:
1. Pick up a field name from ado record set
2. Find the that field name in RANGE table record
3. If found do some calculate and you get a point
4. Compare the calculated point with point(UL/LL) in GRADE table
5. If point found in GRADE table pick up the grade
6. Repeat step 1 to 5 for each field names in ado record set

Here are tables:
Ado Recordset holding records which has:

2002 2003
NIM 14.5 21.55
ROAA 55.12 56.45
ROAE 32.15 45.95

RANGE Table:

Name Wieghtage UL LL Point
NIM 20% 20.00 4.75 1
NIM 20% 4.74 4.00 2
ROAA 30% 100.00 4.75 1
ROAE 30% 4.74 4.00 2
ROAE 30% 3.99 3.25 3
and......

GRADE Table:

Grade LL UL
AAA 1.00 1.49
AA+ 1.50 1.83
AA 1.84 2.16
AA- 2.17 2.49
and ......

Calculation Example at step 3
If ADO's NIM value is 10.5 then POINT from RANGE table will be 1

(1-(10.5-4.75)/20.00-4.75)*20/100

OR
(range.point-(ado's nim value -range.LL)/(range.UL-range.LL))*range.weighate/100

Any help?

Thanks

[1191 byte] By [RoyalStag] at [2007-12-28]
# 1

Hi,

SELECT CASE statements may help in your code.>>

Dim num As Decimal

Dim point As Integer

num = 10.5

Select Case num

Case 4.75 To 100

Point = 1

Case 3.25 To 3.99

point = 2

Case 3.25 To 3.99

point = 3

End Select

See this lot on ADO stuff.>>

http://forums.microsoft.com/MSDN/Search/Search.aspx?words=ado&localechoice=9&SiteID=1&searchscope=forumgroupscope&ForumGroupID=10

Regards,

S_DS

Spidermans_DarkSide at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2

Royal Stag,

This forum supports Visual Basic.NET (7, 7.1, 8, ...) issues only, so, your Visual Basic 6 question is an off-topic here and this isn't the best place to ask it, here is a list of forums, newsgroups, resources and sites, to get an answer about your question :

Remember, you can use Visual Basic 2005 Express (.NET) for free, because it's free-to-download, free-to-register, easy-to-use, easy-to-learn and funny!, why you don't want to take a tour about it?

In a word, Thank you for your question!

BrunoYu-MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...