Hi,
I have a report displaying items that are missing from a room. I
created 2 queries, the first getting the items IN the room, and the
second being an "unmatched" query that references the first query
where Item is Null. I use a subreport for the details, and the
results display correctly.
However, the Report_Details event of the subreport is executed about 2
or 3 times more than I would expect (I think 3 times when I have a
footer, 2 times without). Since I think I've experienced this before,
I'm not sure if this is a problem or an Access thing.
Since the resulting report is fine, I could live with this. BUT, I
need running totals and a grand total, and these are inaccurate
because of the extra number of times the detail event is performed.
So, I created a third query, which provides totals based on Query 2.
My question is: how do I put a field on the subreport (report detail
line) using this query as its source???
Here's an example of the report.
Items Needed for Room Upgrade Report
Room 203
Item 1 Bedspread $10
Item 10 Gray Lamp $15
Item 21 Green Carpet $100
Room 203 Total $125
Room 205
Item 5 Artwork $40
....
....
Room 205 Total $200
....
All Rooms Grand Total $325
The 2 queries are:
Query 1 - selects the items IN the room. The SQL is (here's an
example with an actual room number): -
SELECT tblDesignTypeItems.DesignType, tblDesignTypeItems.ItemID,
-
tblSpaceUse.RoomID
-
FROM tblSpaceUse INNER JOIN (tblDesignTypeItems INNER JOIN
-
tblRoomItems ON tblDesignTypeItems.ItemID = tblRoomItems.ItemID) ON
-
(tblSpaceUse.RoomID = tblRoomItems.RoomID) AND
-
(tblSpaceUse.DesignTypeID = tblDesignTypeItems.DesignType)
-
WHERE (((tblSpaceUse.RoomID)="340"));
-
Query 2 - gives items NOT in the room; references Query1, and where
Item Number is Null (this example uses specific codes for simplicity,
but user will select from lists). -
SELECT tblDesignTypeItems.DesignType, tblDesignTypeItems.ItemID,
-
qryPrototypeMissingSumCost1.ItemID
-
FROM tblDesignTypeItems LEFT JOIN Query1 ON tblDesignTypeItems.ItemID
-
= Query1.ItemID
-
WHERE (((tblDesignTypeItems.DesignType)="c0501") AND ((Query1.ItemID)
-
Is Null));
-
Now I've added Query 3 to sum the Price of all items on query 2 for a
room. This will give the $10, $15, $100 price for each specific item
listed above. Otherwise I can't figure out how to get the item price
on this report, and I've been pulling my hair out.
Sooo... my main question is: how do I attach the results of Query 3
to the cost field on the detail line of my report? I have tried a
text field, a combo box... to no avail. They don't have "record
source".
Thank you so much! I'm in dire straits here and am posting to several
google MS Access groups.
Lori 4 3024
Hi Lori,
You don't make queries to sum information for a report. Just get the
query to display all the fields you want then use the query as the
recordsource for the report. In the report you do the sorts and totals
by using "Sorting and Grouping". In your case you will want to sort by
RoomID so in the Sorting and Grouping you choose "RoomID" and select
Group Footer = Yes. Then in the Group Footer on the report you create
a textbox and the the Control Source for that textbox will be
=Sum([ItemPrice] Substitute the field you used to hold the item's
price for "ItemPrice"
For an item total for all rooms you can copy the textbox into the
report footer, it will copy with the formula intact.
Control Source is found on the Data tab on the property sheet for the
textbox. If this isn't clear then do a search in this group for:
Report Sorting Group totals
Cheers,
Barry
On Jun 18, 8:23 am, lorirobn <lorir...@yahoo.comwrote:
Hi,
I have a report displaying items that are missing from a room. I
created 2 queries, the first getting the items IN the room, and the
second being an "unmatched" query that references the first query
where Item is Null. I use a subreport for the details, and the
results display correctly.
However, the Report_Details event of the subreport is executed about 2
or 3 times more than I would expect (I think 3 times when I have a
footer, 2 times without). Since I think I've experienced this before,
I'm not sure if this is a problem or an Access thing.
Since the resulting report is fine, I could live with this. BUT, I
need running totals and a grand total, and these are inaccurate
because of the extra number of times the detail event is performed.
So, I created a third query, which provides totals based on Query 2.
My question is: how do I put a field on the subreport (report detail
line) using this query as its source???
Here's an example of the report.
Items Needed for Room Upgrade Report
Room 203
Item 1 Bedspread $10
Item 10 Gray Lamp $15
Item 21 Green Carpet $100
Room 203 Total $125
Room 205
Item 5 Artwork $40
...
...
Room 205 Total $200
...
All Rooms Grand Total $325
The 2 queries are:
Query 1 - selects the items IN the room. The SQL is (here's an
example with an actual room number): -
SELECT tblDesignTypeItems.DesignType, tblDesignTypeItems.ItemID,
-
tblSpaceUse.RoomID
-
FROM tblSpaceUse INNER JOIN (tblDesignTypeItems INNER JOIN
-
tblRoomItems ON tblDesignTypeItems.ItemID = tblRoomItems.ItemID) ON
-
(tblSpaceUse.RoomID = tblRoomItems.RoomID) AND
-
(tblSpaceUse.DesignTypeID = tblDesignTypeItems.DesignType)
-
WHERE (((tblSpaceUse.RoomID)="340"));
-
Query 2 - gives items NOT in the room; references Query1, and where
Item Number is Null (this example uses specific codes for simplicity,
but user will select from lists). -
SELECT tblDesignTypeItems.DesignType, tblDesignTypeItems.ItemID,
-
qryPrototypeMissingSumCost1.ItemID
-
FROM tblDesignTypeItems LEFT JOIN Query1 ON tblDesignTypeItems.ItemID
-
= Query1.ItemID
-
WHERE (((tblDesignTypeItems.DesignType)="c0501") AND ((Query1.ItemID)
-
Is Null));
-
Now I've added Query 3 to sum the Price of all items on query 2 for a
room. This will give the $10, $15, $100 price for each specific item
listed above. Otherwise I can't figure out how to get the item price
on this report, and I've been pulling my hair out.
Sooo... my main question is: how do I attach the results of Query 3
to the cost field on the detail line of my report? I have tried a
text field, a combo box... to no avail. They don't have "record
source".
Thank you so much! I'm in dire straits here and am posting to several
google MS Access groups.
Lori
Thank you sooooo much, Ken. This is brilliant. I have been working
on these queries for weeks, and have been so frustrated.
Thank you, Barry, too, for your explanation as well. Once I get this
query working correctly, then I will put in the grouping onto the
report.
I've spent this morning taking your advice, Ken, and following your
example of 1 query (I didn't know about the "not exists" option of the
WHERE clause!).
I've finally got it working, but now I need to add lookup tables for
item descriptions, if I am going to have it in one query. I am a
little stuck on this piece, as I need a "LEFT JOIN" on the lookups.
Can you help with that?
My SQL so far is (I am using a specific room, and will tweak that
later on):
SELECT tblDesignTypeItems.DesignType, tblDesignTypeItems.ItemID,
tblSpaceUse.RoomID, tblitems.ItemID, tblitems.Price,
tblitems.ItemCategoryID, tblitems.MakeID, tblitems.ItemSizeID,
tblitems.ItemSubcategoryID, tblitems.ItemColorID, tblitems.ItemDesc
FROM tblSpaceUse, tblDesignTypeItems, tblitems
WHERE (((tblDesignTypeItems.DesignType)=[tblspaceuse].[designtypeid])
AND ((tblSpaceUse.RoomID)="340") AND
((tblitems.ItemID)=[tbldesigntypeitems].[itemid]) AND ((Exists (Select
tblroomitems.roomid, tblroomitems.itemid
from tblroomitems
WHERE tblroomitems.itemid = tbldesigntypeitems.itemid
and tblroomitems.roomid = tblspaceuse.roomid))=False));
I want to add a left join to tlkpItemCategory (and some other
tables). How/where would I add this left join to this SQL?
By the way, I find the elimination of the INNER and LEFT joins a LOT
simpler to read and understand (as a former mainframe programmer).
Thanks again, Ken. I'm on my way to being done with this! (hopefully
SOON).
cheers,
Lori
Massachusetts, USA
To Ken,
Ken, please post your reply to the group. I would like to read it too!
Barry
On Jun 19, 9:46 am, lorirobn <lorir...@yahoo.comwrote:
Thank you sooooo much, Ken. This is brilliant. I have been working
on these queries for weeks, and have been so frustrated.
Thank you, Barry, too, for your explanation as well. Once I get this
query working correctly, then I will put in the grouping onto the
report.
I've spent this morning taking your advice, Ken, and following your
example of 1 query (I didn't know about the "not exists" option of the
WHERE clause!).
I've finally got it working, but now I need to add lookup tables for
item descriptions, if I am going to have it in one query. I am a
little stuck on this piece, as I need a "LEFT JOIN" on the lookups.
Can you help with that?
My SQL so far is (I am using a specific room, and will tweak that
later on):
SELECT tblDesignTypeItems.DesignType, tblDesignTypeItems.ItemID,
tblSpaceUse.RoomID, tblitems.ItemID, tblitems.Price,
tblitems.ItemCategoryID, tblitems.MakeID, tblitems.ItemSizeID,
tblitems.ItemSubcategoryID, tblitems.ItemColorID, tblitems.ItemDesc
FROM tblSpaceUse, tblDesignTypeItems, tblitems
WHERE (((tblDesignTypeItems.DesignType)=[tblspaceuse].[designtypeid])
AND ((tblSpaceUse.RoomID)="340") AND
((tblitems.ItemID)=[tbldesigntypeitems].[itemid]) AND ((Exists (Select
tblroomitems.roomid, tblroomitems.itemid
from tblroomitems
WHERE tblroomitems.itemid = tbldesigntypeitems.itemid
and tblroomitems.roomid = tblspaceuse.roomid))=False));
I want to add a left join to tlkpItemCategory (and some other
tables). How/where would I add this left join to this SQL?
By the way, I find the elimination of the INNER and LEFT joins a LOT
simpler to read and understand (as a former mainframe programmer).
Thanks again, Ken. I'm on my way to being done with this! (hopefully
SOON).
cheers,
Lori
Massachusetts, USA
Barry - check out google groups forum microsoft.public.access.reports
- I had posted my question to 3 groups, and I guess somehow Ken's
response only showed up on that one (yours showed up on all).
The link is: http://groups.google.com/group/micro...506403a255cc41
I am moving along on my reports... thanks!
hope this helps,
Lori This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Phin |
last post by:
I need your HELP!
I've seen all the posts on using Crystal Reports within vs.net (vb.net)
and changing a SQL query at runtime. When I tried to pass in a dataset
into the crystal report at...
|
by: B Love |
last post by:
I am wondering if I can have a dynamically generated report based upon the
results of a query (in Access2000). Any ideas? Related to that (if that
cannot be done) can the output of a query...
|
by: Richard Hollenbeck |
last post by:
The following query takes about one second to execute with less than 1,000
records, but the report that's based on it takes from 15-30 seconds to
format and display. That's frustrating for both me...
|
by: Chuck |
last post by:
Hi, I have a somewhat unique problem (at least unique to me, and I've
been doing this for longer than I care to admit). I have a client that
needs to print cards onto perforated card stock (so...
|
by: jasenpeters |
last post by:
I'm not sure I understand the use of parameter queries and reports.
I have a query that returns calculations for Categories. There are 6
Categories (A,B,C,D,E,F).
There are also two Types of...
|
by: dancole42 |
last post by:
So I have an invoicing database based on two main forms: Orders and
OrderLines. Orders has fields like:
OrderID
BillingMethod
OrderDate
CreditCard
CCExp
OrdSubTotal
ShippingCharge
|
by: deaconj999 |
last post by:
Hi,
I have nearly finished my database and I would like to add a query
that uses a combo box to get the results, not the usual paramater
style input. I suppose it would need a form and a query...
|
by: RCapps |
last post by:
When running the below SQL Query I keep getting the following error:
Server: Msg 4924, Level 16, State 1, Line 1
ALTER TABLE DROP COLUMN failed because column 'ContractDef' does not exist in table...
|
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ |
last post by:
I am running Access 2007. I have a report that I want to filter. I
can go into Advanced...Advanced Filter/Sort... and setup a filter that
works fine on the report when I apply it. When in this...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: F22F35 |
last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...
| |