pro_vb thread: set form control vaiables at run time....
THANK YOU! it works GREAT! and it is very fast!
I didn't know I could use the datafield like that as a variable.
I also didn't have to set the tag property as it already had the
field name in the datafield property.
here is what I did...
dim otext as textbox
for each otext in me.txtfields
oText.MaxLength = _
adoPrimaryRS.Fields(oText.DataField).DefinedSize
next
> Sorry for the last message, I did not read the whole thread.
>
> I do not know if you create your textboxes at design time or at
> run time. It seems to me that the logical solution (because you
> have so many of them) is to do it at run time and to name every
> textbox with the name of the recordset field. In this way it is
> easy to access the textbox using the Controls collection, like
>
> Me.Controls(fieldname).MaxLength = ...
>
> m.
>
>
> > Set the Tag property of each TextBox to the recordset field
> > name when you create your text boxes, then iterate through
> > your textboxes and get the recordset field from the Tag
> > property, something like (assuming that the
> > textboxes are part of an array, as they should)
> >
> > for i = 0 to mytextbox.count - 1
> > mytextbox(i).MaxLength = _
> > myrecordset.fields(mytextbox(i).Tag).Value
> > next