E
ekoto
Guest
I am gathering information from a user form, using it in calculations and writing it to a table. The fields I am writing to are named F1, F2, F3... F24. Instead of writing add record code 24 times (many times over) I would like to use a variable in the field name and iterate the variable. I have tested the following code but receive "object not found in this collection" error messages:
dummy = 1
For i = 1 to 24
Table1!["F"+str(dummy)] = calculation
dummy = dummy + 1
Next i
Because of the "STR" function I've also tried this code using field names with a space between the F and the number (ie F 1). I've heard this is possible but my numerous variations on the above test have all failed. I'm working in Access 97 and don't have much experience with advanced VB programming. Any solutions would save me writing hundreds of lines of code. Thanks
dummy = 1
For i = 1 to 24
Table1!["F"+str(dummy)] = calculation
dummy = dummy + 1
Next i
Because of the "STR" function I've also tried this code using field names with a space between the F and the number (ie F 1). I've heard this is possible but my numerous variations on the above test have all failed. I'm working in Access 97 and don't have much experience with advanced VB programming. Any solutions would save me writing hundreds of lines of code. Thanks