benjp2k1
05-23-2007, 08:52 AM
I am making a Dynamic Userform which is working fine. My issue is setting values into the textboxes within the form. Basically I make the form and give each textbox a unique name (ex. "txtTitle-1", "txtTitle-2") and I have a function that is taking all of the data within a table and putting it into an array (works fine also). My issue is I am trying to put the value in with the following code:
frmApprover.frameApp.Controls("txtTitle-" & x).Value = aDataAll(x,0)
x is a counter within my loop (starting at 1)
frmApprover is the forms name
frameApp is the frame that the controls are in
aDataAll is my array
I recieve the following error:
"Run-time error '9':
Subscript out of range"
I have tried to remove the loop from the function and just set the field "txtTitle-" & x manually (where x = 1) but still get the same error. But if I manually put "txtTitle-1" it works.
Any ideas how I can make it work within my loop?
frmApprover.frameApp.Controls("txtTitle-" & x).Value = aDataAll(x,0)
x is a counter within my loop (starting at 1)
frmApprover is the forms name
frameApp is the frame that the controls are in
aDataAll is my array
I recieve the following error:
"Run-time error '9':
Subscript out of range"
I have tried to remove the loop from the function and just set the field "txtTitle-" & x manually (where x = 1) but still get the same error. But if I manually put "txtTitle-1" it works.
Any ideas how I can make it work within my loop?