I am writing vba code in Access 2010. I want to pass two parameters to a SELECT statement in code and I can't seem to figure out where the various quote marks go. Here is an illustration: (the variables are already dimensioned as integers)
nStateFIPS = an integer value that comes from an open recordset
nCountFIPS = another integer value that comes from the same recordset
I want to open a second recordset (rst2) based on a query (MyQuery) where both variables determine which records are included.
Here is the line I can't seem to get right:
rst2.Open "Select * From MyQuery where ((fips_st_cd = nStateFIPS) And (fips__cnty_cd = nCountyFIPS))"
The error I get is something to the effect of no value given for one or more of the parameters... When I hover over the variable names where they are given their value, I see the correct values, but they are not getting into the SELECT statement.
Thanks very much in advance...