In my database, the format for 8 columns are as shown:

+------+------+------+------+------+------+------+------+
| MPT  | MPB  | MP1T | MP1B | MP2T | MP2B | MP3T | MP3B |
+------+------+------+------+------+------+------+------+
| 4    | 7    | 1    | 1    | 3    | 3    | 0    | 3    |
|      |      |      |      |      |      |      |      |
| 28   | 5    | 4    | 0    | 24   | 5    | 0    | 0    |
|      |      |      |      |      |      |      |      |
| 19   | 7    | 7    | 1    | 8    | 6    | 4    | 0    |
|      |      |      |      |      |      |      |      |
|      |      |      |      |      |      |      |      |
| 40   | 4    | 33   | 1    | 7    | 3    | 0    | 0    |
| 2    | 121  | 0    | 38   | 2    | 83   | 0    | 0    |
|      |      |      |      |      |      |      |      |
| 26   | 13   | 2    | 4    | 24   | 9    | 0    | 0    |
| 20   | 3    | 2    | 1    | 18   | 2    | 0    | 0    |
| 6    | 20   | 3    | 8    | 3    | 8    | 0    | 4    |
| 5    | 7    | 0    | 1    | 4    | 4    | 1    | 2    |

How can i get access within any rows?
Because if lets say the first column already exceeds 30, then the remainning column i will no need anymore.
I just know how to loop through in columns using RS.Fields("MPT").Value
Any help? Thanks

Are you just looking for the sum of the comulms?

Because you can write a SUM(XXXX) query and just let SQL return you the results. You could also write a SELECT MPT FROM DDDD WHERE MPT > 29...

Em....not exactly...
because there are many columns i need to access....
If the first column already exceeds some amount, then the following columns i may not involve it anymore in calculations

Hi
U can access the column by index.

Example To access the 0th column
u can use RS.Fields(0) Similarly u can iterate all the columns
Ex

Dim i as integer
Dim s as String

For i = 0 To RS.Fields.Count -1
   s = s & RS.Fields (i).Name
Next
MsgBox (s)

This example shows the all column names one by one
I hope this will help to you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.