By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,144 Members | 1,286 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,144 IT Pros & Developers. It's quick & easy.

Query based on a parameter query, Using VBA how do I set the parameters

P: n/a
Jim
MS-Access 2002

I have a query (Q2) based on a parameter query (Q1) and need to set the
parameters within a VBA module. I am using ADO, and opening the query (Q2)
as a fordwardonly recordset.

Since Q1 isn't explictly opened in the VBA code, I'm not sure how to set
the parameters.

I do not want to run Q1 to load a table and then have Q2 based on the table
if I can avoid it. Nor do I want to place the parameters in a table and
have Q1 reference them there.

Any suggestions ?

Thanks
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In DAO you can open query2 that uses query1 with parameters, but there
are no parameters in query2. You just assign the parameter values to
the query2 QueryDef. E.g.:

dim qd as dao.querydef
set qd = db.querydefs("query2")
qd.parameters("LastName")="Smith"
qd.parameters("IDNumber")=12345
set rs = qd.OpenRecordset()

Perhaps you can do the same in ADO - just set the parameters for
query1, but set them in the ADO setup for query2.

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQAH7WIechKqOuFEgEQInKACffFeBEw1jAFOjPi4vz4OEOP ecAoYAoJNB
QlMFFKeVvSTR0AnKVpJuvHBD
=XqQa
-----END PGP SIGNATURE-----
Jim wrote:
MS-Access 2002

I have a query (Q2) based on a parameter query (Q1) and need to set the
parameters within a VBA module. I am using ADO, and opening the query (Q2)
as a fordwardonly recordset.

Since Q1 isn't explictly opened in the VBA code, I'm not sure how to set
the parameters.

I do not want to run Q1 to load a table and then have Q2 based on the table
if I can avoid it. Nor do I want to place the parameters in a table and
have Q1 reference them there.

Any suggestions ?

Thanks


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.