Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic field refering in recordset 1

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everybody,
I have a non normalised set of data, where months of the year are field names, like [01-00], [02-00], meaning januari 2000, februari 2000. I want put these dates in a table as data. So i want to step through these field names and write them to a table. But i dont know how i can step through these field names, if i make myself clear. THis is some code:

So i can refer to a field in the recordset like:
rst![01-00]

But what can i use if i want it like this
rst!varMMYY, where varMMYY is changing all the time, stepping through all the months.

If is use this

varMMYY = CVar("[" & strZeroMonth & CStr(intMonth) & "-" & Right(intYear, 2) & "]")
varPeriodField = rst!varMMYY it causes an error, "item not found in this collection".




Pampers [afro]
Keeping it simple can be complicated
 
Hi Duane, tnx for your reply
But nope, no luck, same error:

item not found in this collection

Pampers [afro]
Keeping it simple can be complicated
 
And this ?
varMMYY = strZeroMonth & CStr(intMonth) & "-" & Right(intYear, 2)
varPeriodField = rst.Fields(varMMYY)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yep, great PHV.
Thanks a lot.
Great that you are still in these fora

Pampers [afro]
Keeping it simple can be complicated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top