Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refer to a Control in Code?

Status
Not open for further replies.

tomco22

Technical User
Sep 16, 2000
74
0
0
US
How do I refer to a control in code. I found a close answer in FAQ's but it doesn't get me there. I have multiple and specific labels I want to set a specific line height to in code. The following snippet does not work.
Code:
Private Sub LineHt(ctlLabeL As Label)
ctlLabeL.LineSpacing = 100
End Sub
=========================
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim ctlLabeL As Label

ctlLabeL.Name = me.lblPar2 '***
LineHt (ctlLabeL)

'Me.lblPar2.LineSpacing = 100
End Sub

This code errors on the line marked "***"

Tom
 
And what about this ?
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
LineHt Me!lblPar2
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH. That works great and will actually eliminate setting the variable name for each control. A lot less typing.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top