-
I'm trying to make an update to record set and update field names day01, day02, day03, day04...
I would like to perform this update by a for loop and then use recordsetname.day & itr = value... for the each iteration of the for loop...
kind of like this...
for i = 1 to countdays
recordset.edit
recordset.day & i = value 'help here
recordset.update
next i
Can anyone help with this pitiful mess?
Thanks,
Marc
-
Try this in its place:
Code:
for i = 1 to countdays
SQLstring= "update tablename set day0" & i & "= " & value & " where some_condition = uniquerecord"
database.execute SQLstring, dbFailOnError
next i
note if the value field is character, then the script changes slightly
Code:
for i = 1 to countdays
SQLstring= "update tablename set day0" & i & "= '" & value & "' where some_condition = uniquerecord"
database.execute SQLstring, dbFailOnError
next i