How do I create a control array?? (1 Viewer)

casey

Registered User.
Local time
Today, 06:16
Joined
Dec 5, 2000
Messages
448
Can someone refresh my memory on creating a textbox array? I have several textboxes on a form that I'd like to write the same procedure that runs when any of them are selected. Thanks.
 

Ron Bell

Registered User.
Local time
Today, 06:16
Joined
Jul 25, 2000
Messages
33
You must be a VB user?
As far as I know textboxes in Access cannot be arrays:
To run same proc. from same box
Use VBA editor and add a named procedure.
This will appear under 'General' for a module
then you can call that procedure from any object (textbox) event
 

casey

Registered User.
Local time
Today, 06:16
Joined
Dec 5, 2000
Messages
448
Ron Bell,
Thanks for your response. (I'm sorry I meant combobox instead of textbox, but I don't believe there's a procedural difference.) Are you saying that arrays of controls are possible only in VB? Because what you suggest works, however, calling a general procedure is exactly what I want to get away from doing. I've been doing just that and my coding window is getting messy(about 40 call statements). In addition, it's very time consuming to write all those statements. With an array of comboboxes, I could write one procedure and then clicking any of the comboboxes would cause that one procedure to fire (In effect, doing the same thing as calling the general procedure w/o the messy code window and w/o all the work).
I appreciate your suggestion and I am open to any further help on this issue.



[This message has been edited by casey (edited 04-05-2001).]
 

Robert Dunstan

Mr Data
Local time
Today, 06:16
Joined
Jun 22, 2000
Messages
291
Hi,

I would have to agree with Ron's suggestion and have a general procedure called from your various combo boxes when the each event is run. Ok this would mean in your code window you would have a lot of call statments and it would look messy to read / debug. You don't say if your current code is working correctly. If it is working Ok then I would leave it.

I think that this one of Access' limitations in that you can't have control arrays but I may be wrong. Unlike in VB itself Access won't allow you to have two or more controls of the same name and you don't have the Index property in order to assign it to a control array
 

Users who are viewing this thread

Top Bottom