So I have a SQL Server pass through query in MS-Access that I created with the query design. I just double click it and it runs and opens up in datasheet view. Then I can export it. The query looks like so:
DECLARE @acyr AS varchar(4);
SELECT @acyr = '2018'
SELECT *
FROM Table
WHERE year = @acyr
I also have a form with a listBox labeled acyrList where the user picks from 2017, 2018, 2019. I would like for acyrList.Value to be passed to the @acyr in the pass through query and return the records for that year.
How can I achieve this ?