I have a form with many 'like' controls. I have named them cboLocation1, cboLocation2...etc. No rather than set up each individual control (i have 23) i am trying to do it in VBA. I have created a control array to attempt to do this. I tried me.cbLocation(i).ControlSource = "location" & e
in the first for next but it told me it couldnt find it or something like that. My data fields are location0, location1, etc...
This is giving me an error in the second for next loop. says it cant find the method or data field. any suggestions would be great.
Dim cbLocation(1 To 4) As Control
Dim i As Integer
Dim e As Integer
e = 0
For i = 1 To 4
Set cbLocation(i) = Controls("cbolocation" & i)
'txtSerial1.Value = "Test" & i
Next i
For i = 1 To 4
me.cbLocation(i).ControlSource = "location" & e
e = e + 1
Next i
in the first for next but it told me it couldnt find it or something like that. My data fields are location0, location1, etc...
This is giving me an error in the second for next loop. says it cant find the method or data field. any suggestions would be great.
Dim cbLocation(1 To 4) As Control
Dim i As Integer
Dim e As Integer
e = 0
For i = 1 To 4
Set cbLocation(i) = Controls("cbolocation" & i)
'txtSerial1.Value = "Test" & i
Next i
For i = 1 To 4
me.cbLocation(i).ControlSource = "location" & e
e = e + 1
Next i