473,568 Members | 2,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1739
-----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("q uery2")
qd.parameters(" LastName")="Smi th"
qd.parameters(" IDNumber")=1234 5
set rs = qd.OpenRecordse t()

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:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBQAH7WIechKq OuFEgEQInKACffF eBEw1jAFOjPi4vz 4OEOPecAoYAoJNB
QlMFFKeVvSTR0An KVpJuvHBD
=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
5710
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 the form of a bar chart based on the data within the report. Can I do this as when I have tried to insert a chart on the report it displays an error...
2
4758
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 values of those 5 text boxes. One of two of these boxes are based on date. The obvious part (being the novice that I am) I'm stuck on is having...
3
3411
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 another shot. I have a report that is based on a crosstab query. The crosstab query is based off of another query, and that has a parameter in the...
13
4212
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 solution here - until now. This one is driving me crazy. I am making my first attempt at creating a runtime application. I am using Access 2003...
1
10802
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 them is to query "qry_last_transition," which is also a parameter query. Both querys use the same parameter: a control called "txtSecondDate" on a...
6
4448
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 have I been able to adapt other people's solutions/tips to fit what I need. If anyone could please help me with the following it would be really...
5
2350
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 Procedures with a data reader to add various parameters. However, if I have a stored procedure such as CREATE usp_SelectfromJobNumbers (@par1...
29
5475
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 basically almost any change I make to how the query is executed (so that it still performs the same function) causes the performance to jump from a...
5
5292
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 user prompted for them). Based on a Microsoft page (http://support.microsoft.com/kb/287437), I tried the following approach: Private Sub...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.