ray14
asked on
How to consist this loop?
Hi,
In my project, I have 2 Access 97 tables (T1 & T2), every one contains only 5 records and one field “F1”. Please I need the LOOP Code which makes me fill “F1” in the record (1) of “T1” by the world “RED” THEN fill “F1” in the record (1) of “T2” by the same world … Then fill “F1” in the record (2) of “T1” by the same world THEN fill “F1” in the record (2) of “T2” by the same world … and so on till the EOF (I mean going between the 2 tables once here and the other there …..till EOF)
Sirs, I know how to use ADO and how to fill the records. I want your help to show me the LOOP code which makes my request mentioned above.
ray14
In my project, I have 2 Access 97 tables (T1 & T2), every one contains only 5 records and one field “F1”. Please I need the LOOP Code which makes me fill “F1” in the record (1) of “T1” by the world “RED” THEN fill “F1” in the record (1) of “T2” by the same world … Then fill “F1” in the record (2) of “T1” by the same world THEN fill “F1” in the record (2) of “T2” by the same world … and so on till the EOF (I mean going between the 2 tables once here and the other there …..till EOF)
Sirs, I know how to use ADO and how to fill the records. I want your help to show me the LOOP code which makes my request mentioned above.
ray14
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why do you need to loop?
why not just do,
conn.execute "Update T1 set F1 = 'Red'"
conn.execute "Update T2 set F1 = 'Blue'"
where conn is your adodb.connection?
why not just do,
conn.execute "Update T1 set F1 = 'Red'"
conn.execute "Update T2 set F1 = 'Blue'"
where conn is your adodb.connection?
ASKER
bobbit31
WIll tht update all records?
mlmcc
WIll tht update all records?
mlmcc
> WIll tht update all records?
it should
it should
RS1.movefirst
RS2.movefirst
do while not RS1.eof
rs1!F1 = "RED"
rs1.update
rs1.movenext
rs2!F1 = "BLUE"
rs2.update
rs2.movenext
loop
'CLOSE THE RECORDSETS
If you know you have 5 records you can use a FOR loop instead
The above assumes T2 has at least as many records as T1
mlmcc