control name???

wh00t

Registered User.
Local time
Today, 06:41
Joined
May 18, 2001
Messages
264
Hi

I have some code which loops through records in a recordset, then changes the properites on a control in a form.

e.g. for each record in table Bay (numbered 1-209), check that the equivalent control on the form has data in, if so then change the backcolor of an adjoined control

using the tID variable works for updating the control name to check, but I can not find a way to update the control name to change the backcolor, I tried using the same method as tID, but when I do this it doesn't recognize it as a control name

does anyone have any ideas?



Code:
Set db = CurrentDb
Set Rs = db.OpenRecordset("Bay")

Rs.MoveFirst

Do While Not Rs.EOF

tID = "t" & Rs![Bay]
ctID = "Ctl" & Rs![Bay]

If IsNull(tID) Then
    Ctl1.BackColor = 12632256
End If

If Not IsNull(tID) Then
    Ctl1.BackColor = 8665
End If

Rs.MoveNext

Loop
 
Code:
Set db = CurrentDb
Set Rs = db.OpenRecordset("Bay")

Rs.MoveFirst

Do While Not Rs.EOF

tID = "t" & Rs![Bay]
ctID = "Ctl" & Rs![Bay]

If IsNull(tID) Then
    Me.Controls(CtID).BackColor = 12632256
Else
    Me.Controls(CtID).BackColor = 8665
End If

Rs.MoveNext

Loop
 
ta, that got it
 
As an after thought, I discovered that you can set conditional formating on controls by right clicking the control.
 

Users who are viewing this thread

Back
Top Bottom