Variable used in recordset field name
I have a output table in Access that contains 30 fields named Field1 thru Field30. The program loops through an input table that have values that need to be placed in the appropriate fields in the output table. Each input record contains a value, and the field number that it is to be placed in the output table.
To accomplish this the code uses a variable in the output recordset field name. When the code is run, the error "Item not found in this collection" is returned. It appears that the field name is not being interpreted as intended. Any ideas on how the syntax below should be adjusted??
THANKS
rsOut.AddNew
Do while not rsIn.Eof
MVar = "Field" & rsIn!FieldNum
rsOut![ & MVar & ] = rsIn!InputData
rsIn.MoveNext
Loop
rsOut.Update
|