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
247 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
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now