Creating Variable Name From Another Variable
Posted on 2013-11-20
I have to read rows from a table into variable names and then compare them to the next row in the table. So I want to read the rows into a recordset, set a variable equal to each field in the recordset and then read the next row and compare the recordset values to the established field values from the previous row.
There's a large number of fields, and the number of fields - and underlying table structure - could change over time. So rather than hard code the variable names like this:
Dim strVariableName As String
I want to maintain a table with the Field Names and Variable Names and then use a recordset from THAT table to examine the table with the actual data in it. So I need to know how to write a command that does this:
Dim rsTableStructure!FieldName As String
But I need to be able to REFER BACK TO THAT "rsTableStructure!FieldName" to examine its contents later on.
Is there a way to do this or do I need to dream up some kind of array structure.