## obicerno

hello guys, can any one know how to extract an amount for an instance..

this was in access data. i just picking up some sample..

a given amount to be extracted was 50,000.00 kilos

i have to table 1 is the master and the other was the list of pickup data from master which is the bases of my 50,000.00 target amount

in trying to used this in DAO

var = 0
given = 50000

do while var = given
if var <> to given then

else

end if

loop
end do

the sample data is show in query

Planter_Name _ kilos

ALIGATO, MARY ROSE 1,403.46
ALIGATO, ROQUE 5,744.48
ALMO, ROSEMARIE 1,248.48
ALVIOLA, MARIDEL 1,230.63
ALVIOLA, RHODEL 1,261.46
ALVIOLA, ROGELIO 684.08
AMANDORON, ROEL 2,235.95
AMBAY, ARIEL 634.64
ANTONIO, AMBOY F. 832.66
ARANAS, PRISCO 9,284.04
AREJA, RICHARD 1,074.80
AUGUIS, FE 1,168.92
BALABA, LEONILA 2,151.74
BALBUTIN, ROMEO 591.06
BALDOSANO, DODONG 2,870.29
BALICAO, ELVINO, SR. 1,299.93
BALICAO, REMIE 4,370.66
BANTAYAN, FRANCISCA 4,032.38

## debasisdas 580

I am sorry,

i really do not understand the question.

## AndreRet 362

Are you trying to do a sum of all the weight data (4000 + 40000 + 6000 = 50 000) and then add this to a field in your table?

## obicerno

yes, just something like that, picking of weight data which is the sum is equal to 50,000 and then put it in another table..

## debasisdas 580

You want to pick the records randomly or is there any order to follow (may be by name or date or something)

## AndreRet 362

Your code will then look something like this -

``````Rs.Open "SELECT Planter_Name_ kilos FROM YourTableNameHere", YourConnectionNameHere, adOpenStatic, adLockOptimistic

Dim xTotal As Integer
xTotal = 0

If Rs.EOF = True Or Rs.BOF = True Then
msgbox "No data to count"
Else
For xTotal = 0 To Rs.Recordcount - 1
xTotal = xTotal + Rs!Planter_Name_ kilos
Rs.MoveNext
Next xTotal