Access Recordset data

R

Ralph W

I am using a recordeset to obtain data that I am using to update another
table. I used: Dim RS as recordset , then opened the recordset and want to
set the value of the first column to a string variable, update it to another
table then loop back through to the second column etc.
I have ---
x = x + 1
Name1 = x
Name 2 = RS1![DICT1]
--- this way Name 2 works fine
but if I try to loop through the columns by using
Name 2 = "RS1![DICT" & name1 & "]"
then I literally get the string as written and not the value from the
recordset.
The loops and counters work fine -- its just getting Access to read the data
and not literally the string value.
Hope this makes some sense -- THANKS VERY MUCH!!!!!
 
D

Dirk Goldgar

Ralph W said:
I am using a recordeset to obtain data that I am using to update
another table. I used: Dim RS as recordset , then opened the
recordset and want to set the value of the first column to a string
variable, update it to another table then loop back through to the
second column etc.
I have ---
x = x + 1
Name1 = x
Name 2 = RS1![DICT1]
--- this way Name 2 works fine
but if I try to loop through the columns by using
Name 2 = "RS1![DICT" & name1 & "]"
then I literally get the string as written and not the value from
the recordset.
The loops and counters work fine -- its just getting Access to read
the data and not literally the string value.
Hope this makes some sense -- THANKS VERY MUCH!!!!!

You can do it like this:

Name2 = RS1("DICT" & name1)
 
R

Ralph W

This worked great -- THANKS!!!!!!!!!

Dirk Goldgar said:
Ralph W said:
I am using a recordeset to obtain data that I am using to update
another table. I used: Dim RS as recordset , then opened the
recordset and want to set the value of the first column to a string
variable, update it to another table then loop back through to the
second column etc.
I have ---
x = x + 1
Name1 = x
Name 2 = RS1![DICT1]
--- this way Name 2 works fine
but if I try to loop through the columns by using
Name 2 = "RS1![DICT" & name1 & "]"
then I literally get the string as written and not the value from
the recordset.
The loops and counters work fine -- its just getting Access to read
the data and not literally the string value.
Hope this makes some sense -- THANKS VERY MUCH!!!!!

You can do it like this:

Name2 = RS1("DICT" & name1)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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

Top