473,769 Members | 6,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SubQuery parameter for report

I've got a report whose recordsource is a query:

SELECT [Company Information].Company,
qryGatherCredit CardInfoFromCal lRecords.*
FROM qryGatherCredit CardInfoFromCal lRecords LEFT JOIN ([Number Cross
Reference] LEFT JOIN [Company Information] ON [Number Cross
Reference].[Property Code]=[Company Information].[Property Code]) ON
qryGatherCredit CardInfoFromCal lRecords.[Number ID]=[Number Cross
Reference].[Number ID];

The subquery, qryGatherCredit CardInfoFromCal lRecords, takes 1
parameter, [strCreditCardNo].
When opening this report via VBA, how can I pass a value to this
parameter, then open the report based on these results?
Something like this:

'open the report so can fiddle with recordsource
DoCmd.Echo False 'hides the report when it opens
DoCmd.OpenRepor t strReportName, acViewDesign

Dim objQuery As QueryDef
Set objQuery =
CurrentDb().Que ryDefs(Reports( strReportName). RecordSource)

'Set up the query parameter, [CreditCardNo]
objQuery.Parame ters!strCreditC ardNo = Trim(strCreditC ardNumber)

Reports(strRepo rtName).RecordS ource = objQuery.????
Thanks, gang!

Nov 13 '05 #1
1 2702
On 24 Dec 2004 14:06:36 -0800, "mark"
<ma************ ****@bloglines. com> wrote:

Make the parameter look at a field on a guaranteed-open form for its
value:
select * from mytable where myfield=forms!m yForm!myControl

The form can be hidden. One option is to open that hidden form at
startup time, and leave it open for the duration of the session.

-Tom.

I've got a report whose recordsource is a query:

SELECT [Company Information].Company,
qryGatherCredi tCardInfoFromCa llRecords.*
FROM qryGatherCredit CardInfoFromCal lRecords LEFT JOIN ([Number Cross
Reference] LEFT JOIN [Company Information] ON [Number Cross
Reference].[Property Code]=[Company Information].[Property Code]) ON
qryGatherCredi tCardInfoFromCa llRecords.[Number ID]=[Number Cross
Reference].[Number ID];

The subquery, qryGatherCredit CardInfoFromCal lRecords, takes 1
parameter, [strCreditCardNo].
When opening this report via VBA, how can I pass a value to this
parameter, then open the report based on these results?
Something like this:

'open the report so can fiddle with recordsource
DoCmd.Echo False 'hides the report when it opens
DoCmd.OpenRepo rt strReportName, acViewDesign

Dim objQuery As QueryDef
Set objQuery =
CurrentDb().Qu eryDefs(Reports (strReportName) .RecordSource)

'Set up the query parameter, [CreditCardNo]
objQuery.Param eters!strCredit CardNo = Trim(strCreditC ardNumber)

Reports(strRep ortName).Record Source = objQuery.????
Thanks, gang!


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2354
by: Maarten | last post by:
I've the following problem: Table1 serie | dir Table2 serie | user I am making a webpage in php to administrate the values in the db. What I want is that I select all series from table 1 with an checkbox and
2
6397
by: btober | last post by:
I run the following script to export some data from my development database and then update or insert the records into to the quality assurance testing database, but I get a warning notice that I don't understand. Aside from that notice, the script appears to work as intended, i.e., updating existing report definitions and adding any new ones defined in the dev environment but not appearing in QAT. Here is the script: \set...
8
19600
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a couple of tables in my database using INNER JOINS and the WHERE clause to specify the required constraints. However, I also want to read two fields from a *single* record from a table called 'Locations' and then apply one of these field's values...
1
7205
by: Tim Marshall | last post by:
A2003. I am getting this error message when I try to set a report's recordsource to an SQL statement or a saved querydef that uses sub-queries. I've debug.printed the SQL, and run it as a stand alone query, as a rowsource for a list box and as a recordsource for a form. There's no problem. I'm only encountering this in reports. As a stop gap, I'm going to use a form for a printe report, bvut I wonder if anyone has encountered...
5
6593
by: Rod | last post by:
I have a client site where the code below has been working happily for at least four months. The site is using SQL Server 7. The code is ASP.NET Last week an error appeared related to the following SQL statement. INSERT INTO OrderItems (ClientID, ProductID, OrderHeaderID, Quantity, Dispatched, BackOrdered) SELECT ClientID, ProductID, 1371 AS OrderHeaderID, Quantity, Dispatched, BackOrdered FROM Basket WHERE RequisitionID = 1369 The...
1
2088
by: yoursteveis | last post by:
Dear all, I have created a main report (for monthly purchase summary) and a sub report (for monthly sales summary). I have linked main report with a parameter query (i.e. purchasesummary1) and I have linked the sub report with another parameter query (i.e salessummary2) when i open main report and sub report separately, they asked me the parameter value once only but when I unite them in a single report (i.e. main report + sub report)...
2
1464
by: flowermusic | last post by:
I am creating a report that would generate a Summary report for Student Activity Attendance. Every student can attend multiple activities, and my report group by student, name, and activity. Then I sum the attendance for each individual activity, as compared to the required attendance ( I get this from count of activity record). Next comes the Total Attendance for each student. I use Sum(SumofAttendance), Access prompt me with "Subquery...
0
1302
by: abednegoo | last post by:
Hi All, I tried to find the solution for my problem, but i couldn't find it. If my problem is already solved somewhere, please provide me the link... I'm not a developer myself, but the application manager who needs to solve the issue :) I have got a problem with out software. It throws an error (Subquery returned more than 1 value, blablabla) at me and I cannot see why. I have this data which is stored in an XSD file. The query is the...
7
2296
by: nsymiakakis | last post by:
Hi All, I am have some trouble with a parameter query that I am hoping someone can guide me. I have a Parameter query with a few fields that people can filter with, Such as "Department", Date Range, Shift... This query is meant to sum the number of "Yes" answers as a percentage from a Y/N field. The query works fine and gives me all the filtered records depending on the choices in the query. Here is my problem. I need to create a report that...
0
9423
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
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
3
2815
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.