How to dynamic set label caption

qwang1115

Registered User.
Local time
Today, 06:18
Joined
Oct 24, 2008
Messages
14
I have a report with 10 labels (lbl1, lbl2, lbl3…lbl10) in the page header. I want to set each label with different captions. The caption data is from another table called Bank (BankID, BankName), and I have 10 banks in the Bank table.

My problem is that I don’t know how to create the label array in VBA, like in VB lbl(1), lbl(2)…. So there is no way to loop each label. Maybe I can use collection to hold each label, but how to use loop to add each label in the collection.

Thanks!
 
Within a loop:

Me("lbl" & x).Caption = "whatever"

where x is the loop counter.
 
It works. Thanks!
 

Users who are viewing this thread

Back
Top Bottom