dynamicly accessing fields in a record source

S

SrMousse

Okay, I am feeling stupid here, I have a complex/dynamic record source that
combines information from 3 tables into a dual crosstab based on records
contained within a fourth table... to make a long story short here is the
just of the record source... I will go into my question following...

Bus. Name
Bus. Contact info
Crosstabed with Rank of current year and prev. year from a "rank" table
(i.e. 2006 and 2005)
Crosstabed with a dynamic selection of categories based of a separate table
(i.e. No. of Employees, Gross Income, Notable Contacts, and more)

the final record souce is the sorted by the current year's rank

I end up with a flat record source containing several static columns and 5-9
dynamically created columns.

I am using VBA to create "Tagged Text" to be imported into Adobe InDesign.
for the body of the table I have planned to use 2 sets of RS loops to plot
the data...

i.e.

<----Start Example Code---->

'Define the Copy Year
iCopyYear = 2006

with rsBusinesses
..movefirst
'Start the first loop
Do While Not .EOF
'Add the basic info to the TagText String
sTagText = sTagText & "<tags>" & !BusName & "<tags>" & !Phone "...etc"

'Start the next loop to add the correct Category info getting the name
of the
'category from the rsBusTypeCategory recordsource
rsBusTypeCategory.movefirst
Do While Not .EOF
sTagText = sTagText & "<tags>" &
rsBusinesses!(rsBusTypeCategory!CategoryName)
rsBusTypeCategory.MoveNext
Loop

'Finish by adding the current year's rank and the last years rank
sTagText = sTagText & "<tags>" & !(iCopyYear) & "<tags>" & !(iCopyYear -
1)
..MoveNext
Loop
End With

<----End Example Code---->

SO... my question is, how in the world do I dynamically address the items
within the table... it was easy to do when I was using access reports,
because it was all based on "Source = ...." strings to fill the text boxes on
the report... but how do I do it within the code itself? can I do something
like rsBusinesses!(iCopyYear) ?

I think there is a way to address the fields by number, which may work, as
the fields should fall within the exact order every time, and I can easily
count the number of dynamically generated fields from the rsBusTypeCategory
record source... but I am hoping there is a more accurate/stable meathod to
dealing with this...

I need help!!!

Thanks so much, and sorry for the lengthy explanation.
 

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