R
Richard
Question for Marsh if possible.
I have a text box named P1Bill1Name and...
Another text box named P1Bill1Paid.
If P1Bill1Name has text in it I want P1Bill1Paid
to be visible. I can do it easily with a line of code.
..P1Bill1Name.SetFocus: If .P1Bill1Name.Text = "" Then .P1Bill1Paid.Visible =
False
The problem is I have 50 Paid textboxes. I want to use a function
with a variable for the Paid text box....
Public Function MakeVisible()
Dim ctlCurrentControl As Control
Dim ctlPaid As Control
Set ctlCurrentControl = Screen.ActiveControl
Set ctlPaid = TextBox
Select Case ctlCurrentControl.Text
Case Is <> ""
'ctlCurrentControl.Name = P1Bill1Name
ctlPaid = Left(ctlCurrentControl.Name, 7) + "Paid"
'ctlPaid.Name = P1Bill1Paid
Me(ctlPaid).Visible = True
Case Is = ""
Me(ctlPaid).Visible = False
End Select
End Function
The Screen.ActiveControl works great but the
ctlPaid doesn't seem to work. I get the error "Object Required."
What am I doing wrong?
Please Help!
I have a text box named P1Bill1Name and...
Another text box named P1Bill1Paid.
If P1Bill1Name has text in it I want P1Bill1Paid
to be visible. I can do it easily with a line of code.
..P1Bill1Name.SetFocus: If .P1Bill1Name.Text = "" Then .P1Bill1Paid.Visible =
False
The problem is I have 50 Paid textboxes. I want to use a function
with a variable for the Paid text box....
Public Function MakeVisible()
Dim ctlCurrentControl As Control
Dim ctlPaid As Control
Set ctlCurrentControl = Screen.ActiveControl
Set ctlPaid = TextBox
Select Case ctlCurrentControl.Text
Case Is <> ""
'ctlCurrentControl.Name = P1Bill1Name
ctlPaid = Left(ctlCurrentControl.Name, 7) + "Paid"
'ctlPaid.Name = P1Bill1Paid
Me(ctlPaid).Visible = True
Case Is = ""
Me(ctlPaid).Visible = False
End Select
End Function
The Screen.ActiveControl works great but the
ctlPaid doesn't seem to work. I get the error "Object Required."
What am I doing wrong?
Please Help!