A
Al
I have a subform that displays in datasheet form records related to the
parent record. I would like to loop through the subform records setting the
lock and background attributes based upon the value of a variable in the
form.current event. I can do this for one record, but how can it be dome for
all the records? Or what am I missing here?
This code does it for only 1 record:
Private Sub Form_Current()
Dim ctl As Control
For Each ctl In Me.Controls
If Me.Void then
ctl.Locked = True
If ctl.ControlType = acTextBox Then ctl.BackColor =
gclng_Yellow
If ctl.ControlType = acComboBox Then ctl.BackColor =
gclng_Yellow
Else
ctl.Locked = False
If ctl.ControlType = acTextBox Then ctl.BackColor =
vbWhite
If ctl.ControlType = acComboBox Then ctl.BackColor =
vbWhite
End If
Next
Exit_Here:
Exit Sub
End Sub
Thanks for your replies!!
parent record. I would like to loop through the subform records setting the
lock and background attributes based upon the value of a variable in the
form.current event. I can do this for one record, but how can it be dome for
all the records? Or what am I missing here?
This code does it for only 1 record:
Private Sub Form_Current()
Dim ctl As Control
For Each ctl In Me.Controls
If Me.Void then
ctl.Locked = True
If ctl.ControlType = acTextBox Then ctl.BackColor =
gclng_Yellow
If ctl.ControlType = acComboBox Then ctl.BackColor =
gclng_Yellow
Else
ctl.Locked = False
If ctl.ControlType = acTextBox Then ctl.BackColor =
vbWhite
If ctl.ControlType = acComboBox Then ctl.BackColor =
vbWhite
End If
Next
Exit_Here:
Exit Sub
End Sub
Thanks for your replies!!