Steve;
Thank you for replies. Your suggestions are getting me closer to a
solution.
I implimented you last suggestion and it is real close to the answer needed.
It does give all of the answers correctly, but I am having difficulty w/the
report's layout.
You asked for an outline of the Table/Field structure, I consider what I am
working on confidential, not secretive but confidential. Corporate piracy
is one of our concerns. For that reason, if it is acceptable to you, I will
continue to use the clothing analogy.
The tables consist of the "Main" table, (Purchaser's Name/Address/Etc), a
"Personal Info" table, (Place of Employment/Family background/Etc.), a
"Shopping History" table, (Products previously purchased at other
stores/Highest price paid/Etc.) and a "Products purchased from our store"
table, (Coats/Hats/Shirts/Shoes/Etc).
All of the tables have a one-to-many relationship using the Main table's ID.
The report needed has a mandated layout. It cannot vary in any way, or it
will be rejected.
The report is generated to one, and only one page, 8.5" X 14". To stay
within the limitations of the vast amount of possible printers I set the
margins to 7/10s of an inch all around, (which as you are most likely aware
will print on 90% of the printers on the market), with no headers or
footers. (tried it and it bleeds to next page).
The layout of this report is:
Customer Name/Address
Catagories:
Hats:
Stetson, (fixed, (Label's
caption))..........................................(Selling Price*Qty.
Purchased)
Other, (variable name that is generated by bound control)
Other, (variable name that is generated by bound control)......(Total of
both "Others" Selling Price*Qty. Purchased)
Sub-Total Hats ..................Amt.
Shirts:
Arrow, (fixed, (Label's
caption))...........................................(Selling Price*Qty.
Purchased)
Van Hussen, (fixed, (Label's
caption))...................................(Selling Price*Qty. Purchased)
Other, (variable name that is generated by bound control)......(Selling
Price*Qty. Purchased)
Other, (variable name that is generated by bound control)......(Selling
Price*Qty. Purchased)
Other, (variable name that is generated by bound control)......(Selling
Price*Qty. Purchased)
Other, (variable name that is generated by bound control)......(Selling
Price*Qty. Purchased)
Sub-Total Shirts..................Amt.
Total of all Catagories..................Amt.
Using your last suggestions I removed the space at the end of the
expression, (" "). I was also able to get the total selling price as it
should be. What I couldn't achieve was placing those answers in the proper
position in the report.
Tried using unbound controls: =IIf([ProdBuyCatagoryName]="Clothing" And
[ProdBuySubCategoryName]="Shirt",[Prc],""). Answer for that example was
displayed on page 3.
Even tried creating a second report and refering to the control on the
original report. No Go.
Steve; I am not attempting to get you to finish my work. What I am doing is
finishing a project that I have been working on for an extraordinarily long
period of time.
Thank you again for your previous replys and thank you for reading this.
Andy
Steve Schapel said:
Andy,
I am happy to look at this in more detail with you, but it would help
if you could give me an outline of the table/fields structure of the
data we are dealing with, and maybe a fuller example of the output
required for the report.
In the meantime, here is an idea which might be pertinent... You
don't have to do all the data manipulation work in the query. If you
have a query that gives you:
Category SubCategory Brand Price*Amount
... then you can base your report on this query as is, and use the
report's Sorting and Grouping facility to get the desired result. For
examply, make a Group Header for the Category and SubCategory fields.
In the SubCategory Header section of the report, you will then have
the ProdBuySubCategoryName and an unbound textbox with controlsource
set to =Sum([Prc]) which will show the total for all (e.g.) shirts.
- Steve Schapel, Microsoft Access MVP
Steve;
Your suggestion gave me information that I wish I had months ago, would have
saved me a lot of work on another part of the database. Still need some
more help with this portion.
What I'm working on requires that the report conforms to a rigid government
form. I used the first examples of clothing sales to help simplify the
explanation. From your response I know you need more information, so here
it is.
As stated before the report contains 6 catagories and from 3 to 30 items
each. Following the example of clothing sales, the report is similar to
this:
Clothing (ProdBuyCatagoryName)
Shirts (ProdBuySubCategoryName) then the Price is displayed next to it.
(The buyer can choose several different types of shirts listed in a
Combobox, and the Total for all the shirts MUST be displayed next to the
ProdBuySubCategoryName.)
The Combobox contains normally carried brands, (Hanes, Fruit of the Loom,
Etc.), and it also includes an "Other" brand.
The normally carried brand name is listed on the report, the total of the
Price*AmountPurchased must be returned next to that particular brand, and
the "Other" must list it's brand name and it's total price next to it.
In some Catagories there are as many as 6 "Others", in some there is only 1
"Other".
Any suggestions to get me on the correct path to a solution?
Thank You!
Andy
Andy,
Part of the problem is possibly due to the " " as the FalsePart
argument of your IIf expressions. Why do you want to put in a "space"
for all fields?
Anyway, that's beside the point, really, because I would suggest you
try a completely different tack. I haven't 100% grasped what the data
is in qryProdBuyTbl or how you want your report to turn out. But see
what it gives you, and see if you can use it instead, if you do
this...
Make a query based on qryProdBuyTbl.
Add the ProdBuyCatagoryName and ProdBuySubCategoryName fields to the
query design grid.
Enter a calculated field in the next column, like this...
Prc: [ProdBuyUnitsBought]*[ProdBuyUnitPrice]
Make it a Totals Query (select Totals from the View menu).
In the Totals row of the grid, leave Group By in the first 2 columns,
and enter First in the Totals row of the Prc column (or maybe it
should be Sum, I don't know without seeing more about your data).
Use this query as the basis of your report.
Apologies in advance if this is off-beam, based on trying to imagine
what you are really doing. But if I am off-beam, I would nevertheless
feel sure that there is a less complicated way of doing it than
running a separate IIf() function for each data category.
- Steve Schapel, Microsoft Access MVP
Hi;
Is there a simpler way to do the following?
A portion of our database records items sold. There are 6 categories,
"Clothing", "Stationary", Etc. Each category contains from 3 to 30 items.
The report returns the sub-total price, (the item's name is displayed in the
control's label).
I have created a query that returns the correct information using the
following expressions:
ClothingPrc: IIf([qryProdBuyTbl]![ProdBuyCatagoryName]="Clothing" And
[qryProdBuyTbl]![ProdBuySubCategoryName]="Shirt",[qryProdBuyTbl]![ProdBuyUni
tsBought]*[qryProdBuyTbl]![ProdBuyUnitPrice]," ")
StationaryPrc: IIf([qryProdBuyTbl]![ProdBuyCatagoryName]="Stationary" And
[qryProdBuyTbl]![ProdBuySubCategoryName]="Pens",[qryProdBuyTbl]![ProdBuyUnit
sBought]*[qryProdBuyTbl]![ProdBuyUnitPrice]," ")
ETC, ETC, ETC.
The obstacle I'm encountering is that each item prints on a separate report
page. In other words one page displays the price of the shirts, another for
shoes, a third for pens etc etc etc. The remainder of each page is blank.
I believe the reason it is doing this is because of the "blank lines" in the
query.
"Hide Duplicates" is not an appropriate answer because we have some products
that are the same price.
The only solution I can see at this time is creating a separate query for
each Sub-Category but that isn't practical. Too many queries would be
needed.
Anyone have a suggestion?
Thanks in advanced.
Andy