Wonder if anyone can help. I am looping through the controls on a form. If a check box is found i need to check if the coresponding text box is enabled. I do a bit of string manipulation to convert the check box name into the text box name. Below is the code I have at the mo:
For Each cControls In Me.Controls
If cControls.ControlType = acCheckBox Then
s = cControls.NAME
' now get the coresponding texzt box name
sName = "txt" & Right$(s, Len(s) - 3)
'If sName.Enabled Then
If IsNull(sName) Then
txtUserApproved = Null
Exit Sub
End If
'End If
End If
Next cControls
eg. if check box is called chlMech, then i can get the text box name (txtMech), but how can i refer to this as a control. Obviously sName.enabled won't work because sName is a string, not a control.
Hope this makes sense,
Cheers,
Nick
For Each cControls In Me.Controls
If cControls.ControlType = acCheckBox Then
s = cControls.NAME
' now get the coresponding texzt box name
sName = "txt" & Right$(s, Len(s) - 3)
'If sName.Enabled Then
If IsNull(sName) Then
txtUserApproved = Null
Exit Sub
End If
'End If
End If
Next cControls
eg. if check box is called chlMech, then i can get the text box name (txtMech), but how can i refer to this as a control. Obviously sName.enabled won't work because sName is a string, not a control.
Hope this makes sense,
Cheers,
Nick