I am working with an Access database in MS Access 2016 that I inherited from someone else. One of the tables has a field (EthnicID) that contains 2 values: the first column contains a numeric value which is the ID and the second column contains a string value with is the description associated with the ID number. For example: 1,"African-American/Black"; 2,"Caucasian"; 3,"Hispanic/Latino"; etc. The values are from a lookup table named tbl_Ethnicity.
The table that contains the [EthnicID] field (tblClients) shows the following Field Properties in Table Design in the "Lookup" tab: Display Control: Combo Box Row Source Type: Table/Query Row Source: tbl_Ethnicity Bound Column: 1 Column Count: 2 Column Widths: 0";1" The "General" tab shows the following Field Properties: Field Size: Long Integer Format: Default Value: 0
As you might expect given the above properties, when I view tblClients the EthnicID field/column shows a string value.
However, I am writing some code to generate a new table based on values pulled from tblClients along with values from various other tables (let's not get into a discussion about whether or not this is the best approach!). The process involves generating a new recordset which I then loop through. In the SQL used in the VBA to generate the recordset (rst), I have it select "tblClient.EthnicID" and I want the string value to be returned. However, rst!EthnicID always returns a numeric value, not the string value. I've also tried rst.Fields(9) and rst.Fields(9).Column(1) and rst.Fields(9, 1). Either those don't work or they also return a numeric value; changing the 1 to a 2 does not return a string either (and I'm pretty sure the columns are zero-based).
Is it possible to get the SQL to return the string value from the 2nd column of the table which is displayed in the table rather than the numeric value?
(I do realize I could use a DLookup or a Choose statement in the VBA, but since the string value is already showing in the table, I thought it would be far more efficient to just get the string value directly rather than looking up the string value in tbl_Ethnicity again.)
I've searched the web and didn't find an answer, though I'm probably using the wrong words in the search.
Thanks for any ideas!