By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,611 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,611 IT Pros & Developers. It's quick & easy.

Referencing Array elements on A form

P: 38
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
Feb 10 '08 #1
Share this Question
Share on Google+
2 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
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 ...
Expand|Select|Wrap|Line Numbers
  1. Dim frm As Form
  2. Dim ctl As Control
  3.  
  4. For each ctl in frm.Controls
  5.     If TypeName(ctl) ="TextBox" Then
  6.         ' do something here to pass values to array
  7.     End If
  8. Next ctl 
Feb 10 '08 #2

ADezii
Expert 5K+
P: 8,680
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?
Feb 11 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.