assigning numbers

F

faddrickremo

The below question was asked by my friend,dave,
but he couldnt get a answer.So can somebody help me in
solving the follwing problem.
I have FIVE fields in the table as follows,

B.NO F.NO NAME AMTREF COLLNAME
1 1 dfdfdf 4090
1 2 ffffff 3000
1 3 vvvvv 2000
1 4 jjjjjj 300
1 5 hhhh 200
1 6 ddddd 1000
1 7 ddddd 700
AND I HAVE 3 COLLNAMES COLLNAME1,COLLNAME2,COLLNAME3
how do i assign the AMTREF equally(approximate) to three
names?
i.e COLLNAME1,COLLNAME2,COLLNAME3 should get equal amt
without changing number of records i.e total records
should be 7 only.
 
P

Patrick

This is how I would do-it, hope it helps...
First, put table in a recordSet.

dim Dbs as DataBase
dim rs as recordSet
dim ATM as long

set dbs=currentdb
set rs=dbs.openRecordSet("Select * from tableName")

After,use this recordSet to cycle thru all the lines of
data in your table, but one line at a time, using WITH
statement.
Like This..
WITH rs

while not .EOF
.Edit
ATM= .field("ATMREF").Value
!COLLNAME1=ATM
!COLLNAME2=ATM
!COLLNAME3=ATM
.update
.movenext
Wend
End With

Now, this structure is probably what you need to get the
job done. I'm sure other method exists. If so, don't
exitate to post them.
This code might give you some dificulties with the Edit..
and update. If so try putting them outside the While Loop
instead. Else, I think you should get the results your
looking for... let me know I things turn up!
 
G

Guest

Hello
i cannot view the answer to the queires which i posted .
can some body answer my question.
it is very very urgent.
bye
faddrick
 
F

faddrickremo

Thank you for the help, but I couldnt get the expected
output.
I think you my question is not clear to you.
Let me expalin what iam looking for
i have 2 tables TABLE 1 and TABLE2
Table 1 has following fields
BNO,
FNO
NAME,
AMTREF,
EMPNO

Table 2 has following fields
EMPNO

My intention is to assign the EMPNO of table2 to EMPNO of
table1 one after the another
as follows.

TABLE1 TABLE2
BNO, FNO, NAME, AMTREF, EMPNO EMPNO
1 2 FFF 4000 ------------------------111
1 1 PPP 3000 ------------------------123
1 34 GGG 2000 ------------------------134
1 11 HHH 1000 ------------------------111
1 10 GGK 900 ------------------------123
1 9 HHJ 800 ------------------------134

Thank You.
 
Top