Using a variable as fieldname

MarionD

Registered User.
Local time
Today, 13:29
Joined
Oct 10, 2000
Messages
425
Hi all,
I hope I can explain this properly!
I have a form with 48 unbound text fields name txt1 to txt48.

These are to represent 24 hrs in half hours, to visually represent the hours capacity of my workshop.
Now if I choose a date, which is say Monday, I check my settings, and see that the workshop has a capacity of 15 hrs on a monday. Now I would like to in a loop set the backcolour of the remaining fields to red.

Something like for I = 15 (workshop capacity) to 48

me."txt" & I.backcolour=1111
next I

Is this possible?
Thanks
M
 
Try

Me("txt" & I).Backcolor
 
Hi there! Thanks, but it doesn't work... but this does!

For I = ops!WorkshopTue * 2 + 1 To 48
Me.Controls(CStr("Txt" & I)).BackColor = 11111
Next I

Thanks
 
Really? Are you sure you didn't add a period after Me? In any case, glad you got it working.
 

Users who are viewing this thread

Back
Top Bottom