
Creating text box name based on rs.fields(x).name
Something simple but Iv gone brain dead.
I need to create a large number of text box names on the fly based on a
fields name in a database. These already being on the form, so the name is
know.
e.g.
txtID.Text = Rs.Fields("ID") or can be txtID.Text = Rs.Fields("0")
txtBRNRef.Text = Rs.Fields("BRNRef") or can be txtID.Text =
Rs.Fields("1")
Using this, the field name can be easily returned:
rs.fields(x).name which will return the name of the field x
Thus in effect I want to achive this sort of result. Do you know of a way
around this?
txt + (rs.fields(x).name) . text = Rs . Fields("x") so if field
name is ID, then the above to return txtID.txt
Creating a string with a value of ' txtID.txt ' is not a problem but turning
its 'value' into a 'text box name' Im not sure about. Maybe this is the
route?
Using standard option, if the field is null value, it will of course return
error. Don't want to do the boring need to check every field for nulls
first. Using naming on the fly approach, I can easily check cos its name
will be created based on the field name and checked for null in a loop.
Any thoughts?
Thanks
Dave