Hi all,
Im currently trying to speed up my db, and Im stuck on a bit!
What I have is a table with 14 fields, on a network share, the table has a lot of records, and what Im trying to do, is drag over to a local table, via a query, the records I currently need, the query runs and shows the records between 2 dates, this bit is fine. I then want to store the results of this query in a local table which is basically a copy of the table on the network. I'm using DAO, and what I did was opened 2 recordsets, one for the query, one for the table on the network share, and did the following
I used rstnew and rst old as opened recordsets, then did:
totrecs = rstold.recordcount
for counter = 1 to totrecs
rstnew.fields("first field") =rstold.fields("first field")
rstnew.fields("second field") =rstold.fields("second field")
and so on up to 14th field
next counter
now this works fine, but I need to do this for several tables, is there a way to loop through all the fields in the table such as
for x = 1 to 14 ' nuber of fields
rstnew.fields(x) = rstold.fields(x)
etc, but somehow have it pick up the field name for x?
Hope that makes sense!
TIA
CALV
Im currently trying to speed up my db, and Im stuck on a bit!
What I have is a table with 14 fields, on a network share, the table has a lot of records, and what Im trying to do, is drag over to a local table, via a query, the records I currently need, the query runs and shows the records between 2 dates, this bit is fine. I then want to store the results of this query in a local table which is basically a copy of the table on the network. I'm using DAO, and what I did was opened 2 recordsets, one for the query, one for the table on the network share, and did the following
I used rstnew and rst old as opened recordsets, then did:
totrecs = rstold.recordcount
for counter = 1 to totrecs
rstnew.fields("first field") =rstold.fields("first field")
rstnew.fields("second field") =rstold.fields("second field")
and so on up to 14th field
next counter
now this works fine, but I need to do this for several tables, is there a way to loop through all the fields in the table such as
for x = 1 to 14 ' nuber of fields
rstnew.fields(x) = rstold.fields(x)
etc, but somehow have it pick up the field name for x?
Hope that makes sense!
TIA
CALV