Flecha Negra
Registered User.
- Local time
- Today, 17:20
- Joined
- Dec 4, 2013
- Messages
- 10
Hi
Is it possible to give a name to a Form's Text Box with VBA code like this:
- I have a form with 31 Text Box. Each one as a name: TJan1, TJan2,...,TJan31
- I know the difference between two dates, for instance: 5
- I have a For Next to cycle from 1 to 5
- The Text Boxes are yellow rectangles, that are hidden, but I want to make them visible to show my year's planning
So... here is where I have THE problem... how to tell my Form that I need, for instance, TJan4 to be visible? I have tried something that I learned years ago in Clipper' language... the &(varName) but... no success.
Here's my code:
Dim i, ndias As Integer
Dim arrDias() As String
Dim arraySize As Integer
Dim nomeCampo As String
ndias = 5
arraySize = ndias
ReDim arrDias(1 To arraySize)
For i = LBound(arrDias) To UBound(arrDias)
nomeCampo = "TJan" & CStr(i)
me.&[nomeCampo].visible=true 'doesn't work and...
' I don't want to make this:
' TJan01.Visible = True
' TJan02.Visible = True
' TJan03.Visible = True
' TJan04.Visible = True
' TJan05.Visible = True
Next i
Is this possible? Can I "borrow" the content of my var "nomeCampo" to:
Me.<TextBox_Name>.Visible = True
I appreciate any help. Thanks.
Is it possible to give a name to a Form's Text Box with VBA code like this:
- I have a form with 31 Text Box. Each one as a name: TJan1, TJan2,...,TJan31
- I know the difference between two dates, for instance: 5
- I have a For Next to cycle from 1 to 5
- The Text Boxes are yellow rectangles, that are hidden, but I want to make them visible to show my year's planning
So... here is where I have THE problem... how to tell my Form that I need, for instance, TJan4 to be visible? I have tried something that I learned years ago in Clipper' language... the &(varName) but... no success.
Here's my code:
Dim i, ndias As Integer
Dim arrDias() As String
Dim arraySize As Integer
Dim nomeCampo As String
ndias = 5
arraySize = ndias
ReDim arrDias(1 To arraySize)
For i = LBound(arrDias) To UBound(arrDias)
nomeCampo = "TJan" & CStr(i)
me.&[nomeCampo].visible=true 'doesn't work and...
' I don't want to make this:
' TJan01.Visible = True
' TJan02.Visible = True
' TJan03.Visible = True
' TJan04.Visible = True
' TJan05.Visible = True
Next i
Is this possible? Can I "borrow" the content of my var "nomeCampo" to:
Me.<TextBox_Name>.Visible = True
I appreciate any help. Thanks.