I have a form that has seven columns of information. There are 40 rows of information. Each Text Box is named as follows:
Task1ID Task1 Task1DueDate Task1NA Task1Date Task1Assign Task1Comments
Task2ID Task2 Task2DueDate Task2NA Task2Date Task2Assign Task2Comments
This continues on for 40 different tasks. The text boxes are not connected to any fields in a table, though they end up being filled with fields from various tables. I wrote the original code filling the 40 groups of text boxes, but now I need to add sorting capabilities. I would like to avoid writing the 40 bits of code again if at all possible. All I need the capability of doing to make this as simple as it should be is the ability to use a variable in the name of the text box when referring to the text boxes in VBA. I have tried a few different methods that do not work shown below. If anyone knows how to do this, it would save hours of monotonous code and would be greatly appreciated!!!!!!!!!!
Task1ID Task1 Task1DueDate Task1NA Task1Date Task1Assign Task1Comments
Task2ID Task2 Task2DueDate Task2NA Task2Date Task2Assign Task2Comments
This continues on for 40 different tasks. The text boxes are not connected to any fields in a table, though they end up being filled with fields from various tables. I wrote the original code filling the 40 groups of text boxes, but now I need to add sorting capabilities. I would like to avoid writing the 40 bits of code again if at all possible. All I need the capability of doing to make this as simple as it should be is the ability to use a variable in the name of the text box when referring to the text boxes in VBA. I have tried a few different methods that do not work shown below. If anyone knows how to do this, it would save hours of monotonous code and would be greatly appreciated!!!!!!!!!!
Code:
Dim TempPTArray(40, 7)
For j = 1 To 40
For k = 1 To 7
TaskID = "[Forms]![ProjectsTracker].[Task" & j & "ID]"
TempPTArray(j, 1) = TaskID
TempPTArray(j, 2) = [Forms]![ProjectsTracker].[Task & j & ]
TempPTArray(j, 3) = [Forms]![ProjectsTracker].[Task & j & DueDate]
Next k
Next j