Correct syntax for two parameters in vba SELECT statement

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...
Ron
rfreudAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
It would be:

rst2.Open "Select * From MyQuery where ((fips_st_cd = " & nStateFIPS & ") And (fips__cnty_cd = " & nCountyFIPS & "))"

/gustav
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rfreudAuthor Commented:
Thank you Gustav.  I must leave my office right now and will try this out later today or tomorrow.  I really appreciate your help.  
Thanks,
Ron
0
rfreudAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for rfreud's comment #a40864255

for the following reason:

This solution worked - and after all that is the most important thing.  The response from Gustav was quick and accurate.  This kind of assistance is highly valuable for people like me who don't write code every day and who may forget or never develop the kinds of coding skills necessary to be able to these tasks without a struggle.  Thanks Gustav.
0
rfreudAuthor Commented:
Quick and very accurate result.  It really helped me tremendously.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.