L
Larry R Harrison Jr
I have Access 97. I am trying to reference a form control's name in code. I
have this:
Dim sFr as Form
Set sFr=Forms![frmSchedule]
Then I have a multi-dimensional variable name which references certain text
boxes on the form. Yes, there is a reason I do this.
If a user has checked a check box on the form, the text box next to the
check box needs to change fore colors. The code I have looks like this:
For x = 1 To 7
For n = 1 To 3
If sFr.Controls(stDay(x, n, 1)).Value = True Then ' This line works just
fine
sFr.Controls(stDay(x, n, 2)).BackColor = 128
sFr.Controls(stDay(x, n, 2)).BackStyle = "Normal" ' This line-and possibly
the one above it--are the ones giving me trouble
'MsgBox "control " & stDay(x, n, 1) & "is a sample"
End If
Next n
Next x
The if..then does actually return proper conditions, as I checked it with
the shown MsgBox (commented out). Basically, the code works fine for
checking to see if the code box was checked, the problem is in setting the
corresponding text boxes' backstyle to normal rather than transparent.
Tips?
LRH
have this:
Dim sFr as Form
Set sFr=Forms![frmSchedule]
Then I have a multi-dimensional variable name which references certain text
boxes on the form. Yes, there is a reason I do this.
If a user has checked a check box on the form, the text box next to the
check box needs to change fore colors. The code I have looks like this:
For x = 1 To 7
For n = 1 To 3
If sFr.Controls(stDay(x, n, 1)).Value = True Then ' This line works just
fine
sFr.Controls(stDay(x, n, 2)).BackColor = 128
sFr.Controls(stDay(x, n, 2)).BackStyle = "Normal" ' This line-and possibly
the one above it--are the ones giving me trouble
'MsgBox "control " & stDay(x, n, 1) & "is a sample"
End If
Next n
Next x
The if..then does actually return proper conditions, as I checked it with
the shown MsgBox (commented out). Basically, the code works fine for
checking to see if the code box was checked, the problem is in setting the
corresponding text boxes' backstyle to normal rather than transparent.
Tips?
LRH