Access doesn't support control arrays. The closest you can get is to use a
naming convention for your controls (txt11, txt12, txt13, etc) and then
refer to the controls using Me.Controls("txt" & xvalue & yvalue)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> i wish to deposit certain values in certain controls, basically this is a
> form where a refund value is to be split up into its indivudal numbers (which
[quoted text clipped - 29 lines]
>
> Amit
DowningDevelopments - 31 Mar 2006 15:38 GMT
can i pass an array of strings which hold the names of the text boxes and
then construct the textboxes that i want to insert into?
Ive tried to do this below but its throwing up and error that im still
looking at. I know its a little stupid but i dont want to go aroudn changing
my textbox names as iv got other calculations in this module which would need
altering! but ill change it if all else fails
Dim NumberSize As Integer
Dim box As Integer
Dim boxNames(4) As String
Dim TextControl As String
NumberSize = Len(refund)
box = 0
boxNames(0) = "units"
boxNames(1) = "tens"
boxNames(2) = "hundreds"
boxNames(3) = "thousands"
'while there are still numbers left in the value
Do While NumberSize > 0
'set the field to work with
TextControl = boxNames(box)
'find the value of the last number and put it into the field
Me(TextControl) = ConvertDigit(Right(refund))
'chop of that last number
refund = Mid(refund, 0, NumberSize - 1)
box 1
Loop
> Access doesn't support control arrays. The closest you can get is to use a
> naming convention for your controls (txt11, txt12, txt13, etc) and then
[quoted text clipped - 36 lines]
> >
> > Amit
Douglas J. Steele - 31 Mar 2006 23:26 GMT
Try using Me.Controls(TextControl) rather than Me(TextControl)
I suspect that you meant box = box + 1, rather than box 1
I also don't see anything in your code that changes the value of NumberSize,
meaning that you've got an infinite loop there.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> can i pass an array of strings which hold the names of the text boxes and
> then construct the textboxes that i want to insert into?
[quoted text clipped - 75 lines]
>> >
>> > Amit