Access 2007 Control Array (1 Viewer)

me1258

Registered User.
Local time
Today, 01:24
Joined
Apr 6, 2004
Messages
37
Anyone know if Access 2007 has control arrays or some thing similar?
Thanks
 

KeithG

AWF VIP
Local time
Yesterday, 23:24
Joined
Mar 23, 2006
Messages
2,592
I know prevous versions of Access do not support control arrays but sure about 2007.
 

me1258

Registered User.
Local time
Today, 01:24
Joined
Apr 6, 2004
Messages
37
I have looked at several books and sites and I done seem to find where it says that it does or doesn't. Seems odd that they wouldn't include that.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:24
Joined
Feb 28, 2001
Messages
27,438
I don't know that I understand your question. Perhaps this is something I have missed somewhere, but what do you mean by a control array?

I know that all forms in Access have a controls COLLECTION that looks like an array and can be referenced like one. But from the way this thread is developing, I doubt that is what you meant.
 

Dreamweaver

Well-known member
Local time
Today, 07:24
Joined
Nov 28, 2005
Messages
2,466
I think He may be talking about VB Where a group of buttons can be put into something like an option group I used it in vb years back for a calclator IE select all controls and vb asked if you wanted to group that selection.

Been a long time though so not 100% there.

Mick
 

boblarson

Smeghead
Local time
Yesterday, 23:24
Joined
Jan 12, 2001
Messages
32,059
There are no true control arrays in Access. Even the option group in Access isn't really the same as an option group in VB. They don't work the same. In an Access option group, if you want to refer to a specific control within the option group, its name for reference is different for each control. Say you have an option group with 3 options. Option 1 could be named Option22 and the next one is Option24, and Option 26 (labels get added too so they take up the other numbers). But, in VB you can refer to the index of the control as in Option1(2) for the third option.
 

BrettStah

Registered User.
Local time
Today, 01:24
Joined
Apr 15, 2007
Messages
49
The VB control arrays have some nice features - I miss them sometimes when working within Access forms.

In VB, all controls within a control array share the same name and same event procedures, but each button as a different Index property. So if you have 10 command buttons in an array, they'd all be named something like "Command1". When you went to the "Click" event procedure for any of the 10 buttons, you'd wind up in the same procedure - one procedure shared amongst all 10 buttons. The way that you differentiate among these 10 buttons would be by the "Index" value, which is conveniently passed in to each event procedure as an argument named "Index". Here's an example of a normal Click event procedure, and then after that is an example of a Click event procedure from a control array:
Code:
Sub Command1_Click() 
  msgbox "Command1 clicked!"
End Sub

Sub Command1_Click(Index as Long)

  Select Case Index
    Case 0
        msgbox "Button with index #0 clicked!"
    Case 1
        msgbox "Button with index #1 clicked!"
    Case 2
        msgbox "Button with index #2 clicked!"
  End Select
End Sub
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:24
Joined
Feb 28, 2001
Messages
27,438
OK, I don't work in straight-out VB very much so hadn't run into that one. My coding in Windows environments is VBA. My coding in other environments is BASIC or Ada, none of which have control arrays as described. Figured I had missed something.

Now that I understand it, I can confirm that VBA doesn't have it.
 

Users who are viewing this thread

Top Bottom