SARProgrammer
Technical User
MS Access 2003
I have a form consisting of a matrix with 21 columns by 50 rows using a comboBox in a subform. On the main form I have 21 vertically aligned textboxes which will each contain the name of a trainee.
A query is used to determine the trainees in attendance on any given date. A recordset is created and an array is filled with the information needed for this particular subroutine (LName, FName).
All the name textboxes are named as follows:
nameTextBox_01
nameTextBox_02
nameTextBox_03
. . . . . . . . .
nameTextBox_20
nameTextBox_21
Although I am able to build the name of the control as a string:
Dim append as string
append = CStr(intRecord)
If Len(CStr(intRecord)) < 2 Then
append = "0" & CStr(intRecord)
End If
ctrl = "Me.nameTextBox_" & append
Resulting in “Me.nameTextBox_01” through “Me.nameTextBox_21”
How can I assign the values in the array to the name textboxes
Given TrainingAttendanceArray(1, intRecord) is Last Name
TrainingAttendanceArray(1, intRecord) is First Name
Currently I have the following lenghly case statement:
For intRecord = 0 To UBound(TrainingAttendanceArray, 2)
Select Case intRecord
Case 0
Me.NameTextBox_01 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
Case 1
Me.NameTextBox_02 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
. . .
Me.NameTextBox_20 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
Case 20
Me.NameTextBox_21 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
End Select
Next intRecord
Is there a simple way to convert the string of the control name “Me.NameTextBox_01” to the control name Me.NameTextBox_01 ?
I have a form consisting of a matrix with 21 columns by 50 rows using a comboBox in a subform. On the main form I have 21 vertically aligned textboxes which will each contain the name of a trainee.
A query is used to determine the trainees in attendance on any given date. A recordset is created and an array is filled with the information needed for this particular subroutine (LName, FName).
All the name textboxes are named as follows:
nameTextBox_01
nameTextBox_02
nameTextBox_03
. . . . . . . . .
nameTextBox_20
nameTextBox_21
Although I am able to build the name of the control as a string:
Dim append as string
append = CStr(intRecord)
If Len(CStr(intRecord)) < 2 Then
append = "0" & CStr(intRecord)
End If
ctrl = "Me.nameTextBox_" & append
Resulting in “Me.nameTextBox_01” through “Me.nameTextBox_21”
How can I assign the values in the array to the name textboxes
Given TrainingAttendanceArray(1, intRecord) is Last Name
TrainingAttendanceArray(1, intRecord) is First Name
Currently I have the following lenghly case statement:
For intRecord = 0 To UBound(TrainingAttendanceArray, 2)
Select Case intRecord
Case 0
Me.NameTextBox_01 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
Case 1
Me.NameTextBox_02 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
. . .
Me.NameTextBox_20 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
Case 20
Me.NameTextBox_21 = TrainingAttendanceArray(1, intRecord) & ", " & TrainingAttendanceArray(2, intRecord)
End Select
Next intRecord
Is there a simple way to convert the string of the control name “Me.NameTextBox_01” to the control name Me.NameTextBox_01 ?