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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I do this in VBA?

Status
Not open for further replies.

ZABADAK

Programmer
Feb 24, 2005
39
US
I have a table with columns called M1 thru M12 representing data for a month.
Can I load these columns in a loop such as:

For i = 1 to 12
rs.fields("M" & i).value = ....
Next
 
ZABADAK,

If you're at the BEGINNING of the project where you can still make design changes, I would STRONGLY urge you to NORMALIZE your table.

Instead of columns M1 to M12, you ought to have a DATE column and a VALUE column.

Then at report time, using a query, you can do a crosstab to sum values across Date by month.

Skip,
[sub]
[glasses] [red]Be advised:[/red] When you ignite a firecracker in a bowl of vanilla, chocolate & strawberry ice cream, you get...
Neopolitan Blownapart! [tongue][/sub]

 
Thanks for the input. This is a reporting table so I don't believe normalizing is an issue. Essentially, I'm building a table to be used as input to a report. Each of the Mn column values will be the result of a complex SQL query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top