Finding one table's field with a variable

G

Guest

Hi!
I have 3 tables, where one is a download in Excel format that's imported.
Because there are 72 field names that I want to be entries in another
table(72 records), I've been trying to use code that works great on all the
repeating entries, but not for the 'reason I'm doing it' one.

Ok, sorry for the ramble, let me ask you a straight question.
There's rs1, rs2, and rs3 in DAO code for the tables. Table rs1 has the 72
fields that I'm trying to make into 2 fields in rs2. The names of the fields
in rs1 are Jan2000 through Jan2005. In rs3 are those names as entries in a
field called in the code dtname. Now if I simply go to the first record in
rs3 and rs1, from within a nested do loop I can update rs2 to have the values
of rs1 in the respective fields. However, after trying 2 different ways (1.
by declaring and setting the 72 fields and trying to equate them with an
incrementing x value, and 2. having a table, rs3, with the field names as
text values in the same record with a date field value), in both cases if I
can get the engine to accept a variable name as a field name, maybe a
reference I haven't thought of...
ex. Do
With rs2
.Addnew
...
field5 = (rs1.variablename)
I think that sort of explains it,
Here's hoping you can help,
Michele
 
G

Guest

Thank you very much, and especially for your speedy response. It turns out
that one of the recordsets' set statement wasn't right, causing me to think
that the variable wasn't working.

Thanks again!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

stuck in a loop 5
Data Type Conversion error 5
Do loop 1
Please help with this code 1
Recordset from a recordset 3
If Statement Alternatives 6
trouble printing variavel 1
SQL Select in VBA to Open Recordset 2

Top