I am trying to pass a whole recordset into a query. I have made a form, with a listbox that is linked to a table that has 2 columns: Country and CountryID.
When I select the Country on the form, i need the Country and the CountryId to be passed to a query.
Could someone help me on How I can set a variable in VBA that would take it's value from the corresponding recordset when I select the Country in the Listbox.

Example:
Country CountryID
Argentina AG
Brazil BZ
United State US

Given the name for these 2 variables is list.country and list.countryId, how do I make vba.countryId = list.countryId for the corresponding vba.country = list.country?

When I select the Country on the form, i need the Country and the CountryId to be passed to a query.

I understand that when the user selects the country, he/she should get the country id. Is it so? then why do you want to pass the entire record set? Why do you want the country id to be passed in a query? To fetch any other property?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.