Updating Controls in a loop

G

Guest

Hi,

I am currently updating controls using the following process:



Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_1.Caption =
"Feb"

Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_2.Caption =
"Mar"

Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_3.Caption =
"Apr"

Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_4.Caption =
"May"

Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_5.Caption =
"Jun"

Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_6.Caption =
"Jul"


To cut down on code I wanted to put it in a loop, something like:

For I = 1 to 6
If I = 1 Then
The_Month = "Feb"
End If
If I = 2 Then
The_Month = "Mar"
End If
If I = 3 Then
The_Month = "Apr"
End If
If I = 4 Then
The_Month = "May"
End If
If I = 5 Then
The_Month = "Jun"
End If
If I = 6 Then
The_Month = "Jul"
End If


Reports!Rpt_Range_By_Season_Report.Period_Ordered_Month_Label_" & I &
".Caption = The_Month

I've tried the above but it isn't right.

There is more than 1 control. This is only providivg you an idea of what I
am attempting.
 
G

Guest

Found it!!!

Reports!Rpt_Range_By_Season_Report("Range_Ordered_Month_Label_" &
(I)).Caption = The_Month
 

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