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
AUMENTADO, CONSTANCIO 5,480.95
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

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?

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..

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

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

RsTotal.AddNew

RsTotal!YourTotalFieldNameHere = xTotal
RsTotal.Update
This article has been dead for over six months. Start a new discussion instead.