enumerate a collection of text boxes

K

Kuroda

Hello,
I am trying to loop through a series of text boxes named
a0 to a30, and add the values 1 - 30 to each of the text
boxes, but for some reason my code is stopping at the 2nd
line:
For curbox = 0 To 41 'need to loop thru 30 textboxes
Me("D" & curbox) = DatePart("d", curday)
Would anyone help me with this code?
Thanks,
Chieko
 
K

Ken Snell

Dim intNum As Integer
For intNum = 0 To 41
Me.Controls("a" & intNum).Value = DatePart("d", curday)
Next intNum
 
M

Marshall Barton

Kuroda said:
I am trying to loop through a series of text boxes named
a0 to a30, and add the values 1 - 30 to each of the text
boxes, but for some reason my code is stopping at the 2nd
line:
For curbox = 0 To 41 'need to loop thru 30 textboxes
Me("D" & curbox) = DatePart("d", curday)


Well, you said the text boxes are named A0 through A30, but
the code is using D0 through D41.
 
G

Guest

Thanks, that helped.
Chieko
-----Original Message-----
Dim intNum As Integer
For intNum = 0 To 41
Me.Controls("a" & intNum).Value = DatePart("d", curday)
Next intNum

--
Ken Snell
<MS ACCESS MVP>





.
 
K

Ken Snell

< wink >

I noticed that too Marsh, but thought maybe it was just my newsreader
"misreading".... < g, d, & r >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top