S
sh
Hi' there,
I've got a form with 60 different unbound textbox fields, that i want
to fill with data from a table containing 20 records each with 3
fields. This can be done by writing i.e.:
dim i,j,rst
set rst = currentdb.openrecordset("tblTable")
rst.movefirst
Me.F01.value=rst!Field1
Me.F02.value=rst!Field2
Me.F03.value=rst!Field3
rst.movenext
Me.F04.value=rst!Field1
Me.F05.value=rst!Field2
Me.F06.value=rst!Field3
rst.movenext
..
..
....And so on.
Is there a way to dynamicly reference the names of the textbox fields,
so the code could be something like:
dim i,j,rst
set rst = currentdb.openrecordset("tblTable")
rst.movefirst
j=1
for i=1 to 20
Me."F"+format(j,"##").value=rst!Field1
Me."F"+format(j+1,"##").value=rst!Field2
Me."F"+format(j+2,"##").value=rst!Field3
j=j+3
rst.movenext
next
..
..
Kind Regards
Soren
I've got a form with 60 different unbound textbox fields, that i want
to fill with data from a table containing 20 records each with 3
fields. This can be done by writing i.e.:
dim i,j,rst
set rst = currentdb.openrecordset("tblTable")
rst.movefirst
Me.F01.value=rst!Field1
Me.F02.value=rst!Field2
Me.F03.value=rst!Field3
rst.movenext
Me.F04.value=rst!Field1
Me.F05.value=rst!Field2
Me.F06.value=rst!Field3
rst.movenext
..
..
....And so on.
Is there a way to dynamicly reference the names of the textbox fields,
so the code could be something like:
dim i,j,rst
set rst = currentdb.openrecordset("tblTable")
rst.movefirst
j=1
for i=1 to 20
Me."F"+format(j,"##").value=rst!Field1
Me."F"+format(j+1,"##").value=rst!Field2
Me."F"+format(j+2,"##").value=rst!Field3
j=j+3
rst.movenext
next
..
..
Kind Regards
Soren