i'm a beginner to vb6. i wonder if you can help me with this codes.
myStrOn = "SELECT count(*) as AttRate, SubjID FROM tblAttendance WHERE StudID = 'S000000001' and Attendance = 1 group by SubjID;"
myStrCount = "SELECT count(*) as TotalRate, SubjID FROM tblAttendance WHERE StudID = 'S000000001' group by SubjID;"
adoRate.RecordSource = myStrOn
adoRate.Refresh
dgRate.Refresh
adoAll.RecordSource = myStrCount
adoAll.Refresh
dgAll.Refresh
x = dgRate.Columns(0) / dgAll.Columns(0) * 100
MsgBox x
Sample data from datagrid
[u]dgRate</u>
AttRate SubjId
5
Vb
3 ISE
[u]dgAll</u>
TotalRate SubjID
20
Vb
15 ISE
The main purpose is that i want to calculate the 1st column and row of dgRate (5) with the 1st column and row of dgAll(20), and continue with the following rows. But the above codes only show the answer for the 1st row.
I would appreciate your feedback. Thank you.