Control Arrays

Discussion in 'Microsoft Access Database Table Design' started by Guest, Nov 27, 2005.

  1. Guest

    Guest Guest

    control arrays can be used in VB which reduces amount of code that needs to
    be entered. is it possible to use the same concept in MS Access which has VB,
    because the controls don't have "Index" in their properties and Access does
    not allow the user to use the same name for more than one control.
    if control arrays can't be used is there anything else that can be used
    instead?
    thanks.
     
    Guest, Nov 27, 2005
    #1
    1. Advertisements

  2. It's possible to use a naming convention for your controls, and simulate
    control arrays that way.

    For example, if you've got a number of checkboxes, you could name them
    chkBox1, chkBox2, chkBox3 and so on. You can then refer to each of them in a
    loop like:

    Dim ctlCurr As Control
    Dim intLoop As Integer

    For intLoop = 1 to 10
    Set ctlCurr = Me.Controls("chkBox" & intLoop)
    ' Use ctlCurr to refer to the "current" control
    Next intLoop

    As to having event procedures and the like, you can write a generic routine
    that uses Screen.ActiveControl to determine which control is active, and put
    that generic routine as the Event Procedure for all of the controls in the
    pseudo control array.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)



    "Pramatha" <> wrote in message
    news:...
    > control arrays can be used in VB which reduces amount of code that needs
    > to
    > be entered. is it possible to use the same concept in MS Access which has
    > VB,
    > because the controls don't have "Index" in their properties and Access
    > does
    > not allow the user to use the same name for more than one control.
    > if control arrays can't be used is there anything else that can be used
    > instead?
    > thanks.
     
    Douglas J. Steele, Nov 27, 2005
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Vinson

    Re: Help! Database growing out of control!

    John Vinson, Jul 7, 2003, in forum: Microsoft Access Database Table Design
    Replies:
    1
    Views:
    824
  2. Brian C.

    Arrays in Access

    Brian C., Mar 29, 2004, in forum: Microsoft Access Database Table Design
    Replies:
    4
    Views:
    142
    Brian C.
    Mar 29, 2004
  3. Guest

    Arrays fields for the days of a month

    Guest, Jul 31, 2004, in forum: Microsoft Access Database Table Design
    Replies:
    1
    Views:
    129
    Duane Hookom
    Jul 31, 2004
  4. Guest

    Calendar control and time control

    Guest, Jun 13, 2005, in forum: Microsoft Access Database Table Design
    Replies:
    0
    Views:
    133
    Guest
    Jun 13, 2005
  5. Jo Gjessing

    Constants, fixed length strings, arrays, user-defined types and ..

    Jo Gjessing, Feb 11, 2008, in forum: Microsoft Access Database Table Design
    Replies:
    2
    Views:
    892
    Jo Gjessing
    Feb 11, 2008
Loading...

Share This Page