Solved

How can I  read a DAO recordset record, that has redundunt titles (i.e. [Value_1], [Value_2]) in a loop?

Posted on 2008-10-01
2
252 Views
Last Modified: 2013-11-27
I would like to dynamically assign field names using a counter and loop through the fields of a record in a DAO recordset.  Here is an example:

Dim dbs As Database
Dim rs_RIA As DAO.Recordset
DIm wCTR as Integer
Set dbs = CurrentDb
Set rs_RIA = dbs.OpenRecordset("Select * FROM tbl_RIA", DB_OPEN_DYNASET)
wCtr = 1
rs_RIA.movefirst
Do While not rs_RIA.eof
     Do While wCtr <= 28
          <some variable> = rs_RIA.value_ & wctr
    Loop
     rs_RIA.movenext
Loop

Is there a way to dynamically set the field name and then retrieve the data from the field?
0
Comment
Question by:MarkRJackson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 22617172
<some variable> = rs_RIA.Fields("value_"  & wctr)
0
 

Author Closing Comment

by:MarkRJackson
ID: 31502070
Thanks peter57r!  So elegant and so simple.  Much appreciated.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question