Control Array

G

Gilbert2097

I'm using access 2003. I would like to Name my textboxes
text(1),text(2),text(3),etc so that I can iterate thru them with a For Next
Loop (in VBA code) and change their color according to another bit of info.
I thought I found an article that said to name 2 textboxes the same name and
a dialog would popup to ask me if I wanted to create an array. I thought
this was the answer but when I tried it A message refused me to name 2
textboxes the same name. Am I missing something here?? I'll be watching the
mail for a response. Thanx Gil
 
D

Duane Hookom

You can use control arrays in VB but not Access. You can name your text
boxes "text1", "text2",... and then iterate through them like
Dim intI as Integer
For intI = 1 to 14
Me("text" & intI).ForeColor = vbRed
Next
 
G

Gilbert2097

Thanx Duane, It's so easy and I couldn't find anything helpful in all the MS
helps. Maybe they need to be reworked for this subject because I looked for a
couple of hours; I even have the big thick book "Inside Out" and it didn't
address the subject very thoroughly. I appreciate the time you took to
answer me. Gil
 
D

Duane Hookom

John's "Inside Out" covers a lot of ground but can't include everything.
Glad to hear this solution works for you.
 
C

cypher

I know Access does not support control arrays by default, but do you know if
there is a third-party add-in that can give Access 03 this functionality?

Also, if developing application in VB for use in Access, will Access accept
control arrays that were developed in separate stand-alone VB environment, or
will it choke?

Many thanks!
 
M

Marshall Barton

cypher said:
I know Access does not support control arrays by default, but do you know if
there is a third-party add-in that can give Access 03 this functionality?

Also, if developing application in VB for use in Access, will Access accept
control arrays that were developed in separate stand-alone VB environment, or
will it choke?


I don't think so. What's your issue with using a bunch of
text boxes with sequential number suffix?

Developing an app in VB is a totally different critter from
an Access app. You can, with more complexity, use the
default Access database engine Jet or most other databases
such as SQL Server in a VB app (through DAO or ADO), but
that sure seems like the long way around.
 

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