Hi,
I'm trying to set the values of all the fields in a recordset, and would like to reference each field by number rather than name, so I can create a loop to cycle through all fields eg:
Dim rstpiklst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("MyTable", dbOpenDynaset)
rst.MoveFirst
for i = 1 to 10
With rst
!Fields(i) = "Default"
.Update
End With
next i
I can't get it to work, and suspect it is something to do with the syntax of how I am refering to the field. I am getting nowhere with the help file, so if anyone can help me it would be appreciated.
Paul.
I'm trying to set the values of all the fields in a recordset, and would like to reference each field by number rather than name, so I can create a loop to cycle through all fields eg:
Dim rstpiklst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("MyTable", dbOpenDynaset)
rst.MoveFirst
for i = 1 to 10
With rst
!Fields(i) = "Default"
.Update
End With
next i
I can't get it to work, and suspect it is something to do with the syntax of how I am refering to the field. I am getting nowhere with the help file, so if anyone can help me it would be appreciated.
Paul.