PDA

Click to See Complete Forum and Search --> : Symbolic sub for Field name assgnment for recordsets


Oct 13th, 1999, 10:15 PM
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

JHausmann
Oct 14th, 1999, 12:19 AM
Try this in its place:


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


for i = 1 to countdays
SQLstring= "update tablename set day0" & i & "= '" & value & "' where some_condition = uniquerecord"
database.execute SQLstring, dbFailOnError
next i