Hi,
Is it possible to simulate a control array in MS Access?
I’m using a restricted version of Access 2000. I can use all normal features but some Active X controls are not licensed and it will not be possible to licence them in time I have available for my project.
I have a form which has 14 combo boxes and 24 text boxes to allow user to choose shift type and enter start and end times of shift. I know in VB 6 I have used control arrays which has vastly simplified the whole code.
I have experimented with treating the text boxes as objects and trying to create a string with the first part of the name and using numbers to differentiate between the textboxes but Access does not seem to like this.
The code I have tried is below:
Dim obTextBox As TextBox
Dim str As String
str = "Forms!frm_Shift_Entry_3!txtFST2"
‘Set obTextBox = Forms!frm_Shift_Entry_3!txtFST
'Set obTextBox = str
obTextBox.Name = "txtFST2"
obTextBox.Value = Format("12:35", "Short Time")
'b = 7
'obTextBox.Name = "txtFST" & b
'obTextBox.Value = Format("17:12", "Short Time")
commented out sections are other options I have tried.
Can anyone point out any mistakes I’m making or advise whether this is possible in Access?
Thanks
Frozbie
Is it possible to simulate a control array in MS Access?
I’m using a restricted version of Access 2000. I can use all normal features but some Active X controls are not licensed and it will not be possible to licence them in time I have available for my project.
I have a form which has 14 combo boxes and 24 text boxes to allow user to choose shift type and enter start and end times of shift. I know in VB 6 I have used control arrays which has vastly simplified the whole code.
I have experimented with treating the text boxes as objects and trying to create a string with the first part of the name and using numbers to differentiate between the textboxes but Access does not seem to like this.
The code I have tried is below:
Dim obTextBox As TextBox
Dim str As String
str = "Forms!frm_Shift_Entry_3!txtFST2"
‘Set obTextBox = Forms!frm_Shift_Entry_3!txtFST
'Set obTextBox = str
obTextBox.Name = "txtFST2"
obTextBox.Value = Format("12:35", "Short Time")
'b = 7
'obTextBox.Name = "txtFST" & b
'obTextBox.Value = Format("17:12", "Short Time")
commented out sections are other options I have tried.
Can anyone point out any mistakes I’m making or advise whether this is possible in Access?
Thanks
Frozbie