473,385 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
1 1732
-----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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andy Davis | last post by:
I have developed a number of reports that are based on parameter queries where the user enters criteria such as a date range and a sales rep say. I want to be able to show a graphical picture in...
2
by: dskillingstad | last post by:
I'm trying to set up a parameter query based on an unbound form. This search form has about 5 text boxes where the user can type in values within each box and search a specific table based on the...
3
by: Bryan | last post by:
I've been looking over this newsgroup, but I can't find an answer to my problem. I see that a few others have posted this issue over the years, but none of them got a response. I'll give it...
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
1
by: jnikle | last post by:
I have a parameter query named "qry_employee_info_reports" that I need to run in the OnOpen event of a form. I'm after its total number of records. The query's got several joins in it, and one of...
6
by: tizmagik | last post by:
I am having a lot of difficulty generating a CrossTab Query based report. I have looked online for several tutorials and whatnot but I have not been able to really find what I'm looking for, nor...
5
by: ric_deez | last post by:
Hi there, I would like to create a simple search form to allow users to search for a job number based on a number of parameters. I think I understand how to use parameteres associated with Stored...
29
by: wizofaus | last post by:
I previously posted about a problem where it seemed that changing the case of the word "BY" in a SELECT query was causing it to run much much faster. Now I've hit the same thing again, where...
5
by: dana1 | last post by:
Hello Experts! Does anyone know if there is a way to set the values of query parameters from VBA for a report's recordsource? (i.e., I want to set the values of the parameters and NOT have the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.