Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to define a recordset

Status
Not open for further replies.

francky

IS-IT--Management
Aug 19, 2002
19
BE
I want to read the table A and write in the table B

Table A
Field1 Field2
AA 5
BB 3
CC 2

Resutl in the Table B
Field1
AA
AA
AA
AA
AA
BB
BB
BB
CC
CC

But how to define the recordsets

With access 97

Dim db as database
Dim A as recordset, B as recordset
Set db = CurrentDb()
Set A = db.openrecordset("TblA")
Set B = db.openrecordset("TblB")
A.movefirst
do while not A.EOF
do A.Field2
B.addnew
B.Field1 = A.Field1
B.update
loop
A.movenext
loop

But how to do with access 2000
Thanks in advance
 
Hi

Dim db as DAO.database
Dim A as DAO.recordset, B as DAO.recordset
Dim l as Long
Set db = CurrentDb()
Set A = db.openrecordset("SELECT * FROM TblA;")
Set B = db.openrecordset("SELECT * FROM TblB;")
A.movefirst
do while not A.EOF
for l = 1 To A.Field2
B.addnew
B.Field1 = A.Field1
B.update
Next l
A.movenext
loop

will work in A97, and if you set references to dao in Access 2000
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I have a problem with

Dim db as DAO.Database !!!

The message (in french) is :
"Type défini par l'utilisateur non défini"

Type defined by the user not defined !!!???
 
Hi

You do not have the DAO reference.

Open any module in design view

Choose Tools \ References

Ensure you have DAO 3.5 (or 3.6) library Selected

Sorry I cannot say it in French.


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks Ken

All is alright

It was so obvious !!!

Francky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top