A family of Microsoft relational database management systems designed for ease of use.
Dear Carol,
From my research, you do not need a subquery if you only want to display the existing RecordNum field alongside the field selected from the combo box. Replace your current SQL line with:
strSQL = "SELECT [RecordNum], [" & strField & "] " & _
"FROM [WaterTestChemUset] " & _
"ORDER BY [RecordNum
The query will return the columns in this order:
RecordNum | Selected field
ORDER BY [RecordNum] sorts the results by that field. If RecordNum contains gaps, such as 1, 2, 5, and 8, those gaps will remain because this displays the stored values rather than generating a new sequential number.
If you need a newly generated sequence of 1, 2, 3, and so on regardless of the stored RecordNum values, that is a different requirement and would need additional query logic. For most cases, including and sorting by the existing RecordNum field is the simpler and more reliable approach.
I hope this helps. If you specifically need a new consecutive sequence rather than the existing RecordNum, please let me know.
If the answer is helpful, please click "Yes" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in the forum documentation to enable e-mail notifications if you want to receive the related email notification for this thread.