How to refer to controls in a Sub

  • Thread starter Thread starter Filip Neyt
  • Start date Start date
F

Filip Neyt

Hi,



In the Sub below, I don't know how to refer to the control om the TabControl
of the form. acRectangle(strKader) or ![strLabel] are not recognized.

How do I properly refer to these controls?



Thanks





Sub LsFocusColor(strForm As String, intFocus As Integer, intNumOfObj As
Integer)

' ** DESCRIPTION:

' Function designed to change the color of Rectangle and Label of
fsub(on TabControl) that has the focus

' ** INPUT:

' strForm: name of the form

' intFocus: index of fsub that gets the focus

' intNumOfObj: number of fsub (1 to i)on the TabControl

' ** OUTPUT:

' None

' ** REQUIREMENTS:

'

' ** REFERENCES:

'

' ** NOTES:

' Focus: blue RGB(0,128,255)

' No Focus: grey RGB(128,128,128) and vbBlack(for label)

' ** SAMPLE CALL:

'

' ** REVISION HISTORY:

' (none)

' ** AUTHOR / DATE:

' Neyt Filip, 31-05-2006



Dim strKader As String 'Rectangle subform

Dim strLabel As String 'Label subform

Dim i As Integer



'put all to grey/black

For i = 1 To intNumOfObj

strKader = "Kader" & i

strLabel = "Label" & i

Forms(strForm).acRectangle(strKader).BorderColor = RGB(128, 128,
128)

Forms(strForm)![strLabel].ForeColor = vbBlack

Forms(strForm)![strLabel].FontBold = False

i = i + 1

Next i



'put color to the one with focus

strKader = "Kader" & intFocus

strLabel = "Label" & intFocus

Forms(strForm)![strKader].BorderColor = RGB(0, 128, 255)

Forms(strForm)![strLabel].ForeColor = RGB(0, 128, 255)

Forms(strForm)![strLabel].FontBold = True



End Sub
 
Back
Top