bfreescott
Board Regular
- Joined
- Aug 6, 2015
- Messages
- 115
I have a function that I pass string variables to, to make an ADODB connection to another workbook and run a query against. The variables provide the column and row for the table I am querying, so I am trying to understand how I can read the data from the recordset into an array that will be useful when it is returned. How does the array know which field is which?
This select statement will always return only one record/row from the table. If I loaded that recordset into an array, how would I identify the fields that the values are from when the array is returned to the sub? Furthermore, there may be fewer fields in the table than variables I am passing, so I'd like to avoid the 3265 error.
Code:
rs.Open "SELECT * FROM [RCsheet$A1:BK94] WHERE Award = '" & p & "'", Conn, adOpenDynamic
This select statement will always return only one record/row from the table. If I loaded that recordset into an array, how would I identify the fields that the values are from when the array is returned to the sub? Furthermore, there may be fewer fields in the table than variables I am passing, so I'd like to avoid the 3265 error.