I have a table that I am trying to update with a CSV file that I have linked into my Access database. The field names are the same in both locations, but they aren't in the same order, and I can't count on the order remaining the same each time I get the new CSV file.
What I would like to do is loop thru one table and update the field of the same name in the other table.
For example (I know this won't work, its just the general idea)
Code:
Dim fld As Field
Do While Not rs1.EOF
For Each Field in rs1.Fields
rs2.fld = rs1.fld
Next
Loop
I also see this working in a situation where I only want certain fields from a database. I can create an array of field names and loop thru the field names, to get just the fields I want. In my situation, I am doing an update of an Access db from a CSV file provided by a national membership organization. I may not want all the fields they provide. Since I have to check the tables both ways for this system, I would only have to create my field lists one time, and loop thru the lists to compare/update values. It saves typing out 50 field names for each loop to compare/update.
I do this with perl/mysql all the time. Can it be done in VBA?
Thanks for any insight.