Jeff,
I'm sorry about my delay in answering you, but I /still/ have not
been able to reproduce your problem -- I tried as well as I could to
reconstruct what you said you did (and in both Access 2000 and Access
2003), and I never had any trouble in generating the bar chart you said
you wanted. What I suggest is for you to try to copy what I did
(details below). If your results deviate from mine at some point, let
me know how, and that may provide insight into what happened. If you
get the same results I did, then you'll have a working bar chart showing
what you say you wanted.
Incidentally, your statement "criterion: the status of the hold is
equal to 1" doesn't have a basis in the SQL you sent. In my
reconstruction of your database, I assumed that the value of [TB_Hold
Details].[StatusID] (which I renamed to [TB_Hold Details].[Status]
because the "ID" at the end made it look like a linking field) was
always equal to 1.
Note: I had to make some inferences about the structure & contents
of your Tables, but what I came up with is, I think, consistent with
what you described. However, I once again experienced no trouble at all
in setting up the kind of Report or Chart that you described. If I
misapprehended how you have set up your Tables, that might explain the
differing results, but what I describe here is based on my best guess as
to what you did.
The Tables (my version) look like these:
[TB_Categories] Table Datasheet View:
categoryID subcategory
---------- -----------
1 ABC
2 AAA
3 ASC
[TB_Hold Details] Table Datasheet View:
TB_Hold De pallet# Case quant Status MainTableID CategoryID
tails_ID
---------- ------- ---------- ------ ----------- ----------
1 123 3 1 101 1
2 124 5 1 101 1
3 152 3 1 102 2
4 153 3 1 102 2
5 154 4 1 103 3
[TB_Main table] Table Datasheet View:
MainTableID Date
----------- ----------
101 11/10/2005
102 11/12/2005
103 11/15/2005
The Queries produce the following results.
[QR_Subcategories] SQL:
SELECT [TB_Main table].Date, TB_Categories.subcategory,
[TB_Hold Details].Status,
Sum([TB_Hold Details].[Case quant]) AS [SumOfCase quant]
FROM [TB_Main table] RIGHT JOIN
(TB_Categories RIGHT JOIN [TB_Hold Details]
ON TB_Categories.categoryID = [TB_Hold Details].CategoryID)
ON [TB_Main table].MainTableID = [TB_Hold Details].MainTableID
GROUP BY [TB_Main table].Date, TB_Categories.subcategory,
[TB_Hold Details].Status
HAVING ((([TB_Main table].Date)
Between [Forms]![FR_Hold report]![D2]
And [Forms]![FR_Hold report]![D1]));
[QR_Subcategories] Query Datasheet View:
Date subcategory Status SumOfCase quant
---------- ----------- ------ ---------------
11/10/2005 ABC 1 8
11/12/2005 AAA 1 6
11/15/2005 ASC 1 4
[Second query] SQL:
SELECT Sum(QR_Subcategories.[SumOfCase quant])
AS [SumOfSumOfCase quant],
QR_Subcategories.subcategory
FROM QR_Subcategories
GROUP BY QR_Subcategories.subcategory;
[Second query] Query Datasheet View:
SumOfSumOfCase quant subcategory
-------------------- -----------
6 AAA
8 ABC
4 ASC
I ran both the Report Wizard, on [Second query], and the Chart Wizard,
also on [Second query], and both Wizards let me select both of the
fields in [Second query].
I put the chart into the Report's page footer (so that I would get only
one Chart, not the 3 that I would have gotten by putting the Chart into
the detail section). I also de-linked the Chart from the dataset
displayed in the detail section of the Report (so that I could see all 3
categories listed in the Chart, instead of just 1 of them). The Report
looked something like this:
+--------------------
|
| Second query
|
| SumOfSumOfCase quant subcategory
| ----------------------------------------
| 6 AAA
| 8 ABC
| 4 ASC
|
....
(with the bar chart at the bottom, same as I showed you in an earlier
message)
-- Vincent Johns <
[email protected]>
Please feel free to quote anything I say here.
Vincent I appreciate your help with this. I hope I can be more clear about my
problem this time...
Ok, let me try to explain better in details with the help of the documenter:
I have a table, TB_Hold Details that documents details about pallets placed
on hold. This table is linked to another table TB_Main table that is used
mainly to capture the date when these hold events occur (1 to many
relationship). Another table, TB_Categories lists the categories of hold and
the subcategories.
A form (FR_Hold report) is used a a user interface to print reports. it
captures 2 dates between which the data will be retreived from the tables
My first query, QR_Subcategories aims at selecting all the records in the
hold details table that fit within the date range specified in the FR_Hold
report and that meet the following criterion: the status of the hold is equal
to 1. The query sums the cases that are the results of this query
The sql of this query is:
SELECT [TB_Main table].[Date], Sum([TB_Hold Details].[Case quant]) AS
[SumOfCase quant],
[TB_Categories].[subcategory], [TB_Hold Details].[StatusID]
FROM TB_Categories RIGHT JOIN ([TB_Main table] RIGHT JOIN [TB_Hold Details]
ON [TB_Main table].[RecordID]=[TB_Hold Details].[link]) ON [TB_Categories].
[categoryID]=[TB_Hold
Details].[Category]
GROUP BY [TB_Main table].[Date], [TB_Categories].[subcategory], [TB_Hold
Details].[StatusID]
HAVING ((([TB_Main table].Date) Between [Forms]![FR_Hold report].[D2] And
[Forms]![FR_Hold report].[D1]
Now I created a second query based on the 1st one: QR_Subcategories Query
that sums the case quantity in each subcategory. The sql is:
SELECT Sum([QR_Subcategories].[SumOfCase quant]) AS [SumOfSumOfCase quant],
[QR_Subcategories].[subcategory]
FROM QR_Subcategories
GROUP BY [QR_Subcategories].[subcategory];
Based on this 2nd query, I launch the chart wizart under the report creation
wizard to create a bar chart that will show the number of cases for each
subcategory.
One of the very 1st screen of the wizard lets you select the fields to be
involved in your graph. But the field subcategory is not showing in the list.
Therefore I cannot select it to be the x of my graph
Vincent said:
I still can't make it work. I am not sure what you mean by posting the
properties of the chart with the documenter.
"Documenter" is available at Tools --> Analyze --> Documenter, and it
produces a wizard that lets you specify all sorts of options for
creating a report about what's in your database, such as descriptions of
the fields in all your Tables. It's easy to display more stuff than
you'll ever use, so be careful. If you choose to use it, you may need
to play with it some to get what you want.
I suggested using it to display the parameters that you used for
displaying your chart, as I had no trouble doing that (see my previous
message for a drawing of what I got).
The query is adding the number of cases for each subcategories taking the
data from a table.
[quoted text clipped - 12 lines]
and at this point, the Table data are immaterial, as the Query results
are all that you wish to plot on your graph, I assume.
The graph is supposed to display in bar chart the result of the query.
Does that make sense?
Yes, it does. What I don't understand is what you tried to do that
didn't work, since it worked well for me. What did you try to do?
If not let me know how to use the documenter
Thanks for your help
J
Perhaps you could list (from the time you were able to display the
correct values with your Query) what you did, and what happened as a
result that didn't produce the graph you wanted.
-- Vincent Johns <
[email protected]>
Please feel free to quote anything I say here.