Referencing Array elements on A form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • salzan
    New Member
    • Feb 2008
    • 38

    Referencing Array elements on A form

    I'd like to create a form that populates an Array directly instead of writing the code to move individual controls values to an array. Is that even possible?
    Thank you in advance.
    Salzan
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    If as I think you mean binding a form to an array then the answer is no. However, you could set up a table to hold the array positions, one to each column and bind the form to that table. This is probably not the most practical way to do this however.

    If all the controls on the form represent positions in the array you could always look through the controls on the form quickly using a form loop. In fact controls on a form are an array by default but this includes labels etc.

    Something like ...
    [CODE=vb]
    Dim frm As Form
    Dim ctl As Control

    For each ctl in frm.Controls
    If TypeName(ctl) ="TextBox" Then
    ' do something here to pass values to array
    End If
    Next ctl [/CODE]

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by salzan
      I'd like to create a form that populates an Array directly instead of writing the code to move individual controls values to an array. Is that even possible?
      Thank you in advance.
      Salzan
      Hello Salzan, I think what you may be referring to, especially if you're a VBer, are Control Arrays, if so you are out of luck since VBA does not support them. If this is not your intention, simply ignore this statement. Just for curiosity, what exactly are you trying to achieve?

      Comment

      Working...