Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use 2 columns in Detail Section of report 1

TrekBiker

Technical User
Nov 26, 2010
334
GB
I want to reduce the size of the product list in this report by spreading the items over 2 columns in the Details section.
View attachment 1585

Page Set-up has an option for 2 columns but this would apply it to the whole report, so the advice is to use a subreport for the Details section and make this 2 columns.

So far I haven't been able to stop it filling just one of the columns so how do I initiate using both. I've tried both options for Down/Across and Across/Down.
 
Across and then down should work in a subreport to create multiple columns. What is the width of the subreport as well as the subreport control on the main report.

Since the details are now in the subreport, did you remove this table from the recordsource of the main report?
 
Thanks Duane. I also saw your reply to a post elsewhere, showing how to get 2 columns with varying heights of subreport. But I couldn't replicate it, sorry, as there's something I'm missing.

A I've attached a mock up of a test database if you have a moment to see where I'm going wrong.

Hope you're fully fit and well now but imagine it's too cold there for biking!
 

Attachments

  • Test 2 Columns.zip
    3.7 MB · Views: 2
I haven’t reviewed the database yet but are you using the report Print Preview?

Too cold to ride outside so using a stationary bike inside.
 
Last edited:
No, how does that affect it? The samples you put on your other example opened to show the data in two columns so I assumed I could do the same, but no.
 
My results using Report View
1737852921344.png
The same report using Print Preview
1737852976901.png

I can't recall ever using Report View but that may just be my old ways.

You might be able to achieve two column in Print View if you can calculate a column in the subreport's record source that divides the records into two groups for instance 1 and 2. Then add two copies of the same subreport side-by-side with text boxes with control sources of =1 and =2. Add these text boxes to the Link Master/Child to get the "1" records on the left and the "2" records on the right.
 
Last edited:
The last paragraph can be created with a subreport record source of:
Code:
SELECT [Order Details].OrderDetailID, [Order Details].OrderID, Products.ProductName, [Order Details].Quantity,
 Round((SELECT Count(*) FROM [Order Details] OD WHERE OD.ORderID = [Order Details].OrderID AND OD.OrderDetailID <= [Order Details].OrderDetailID)/
 (SELECT Count(*) FROM [Order Details]  OD WHERE OD.OrderID = [Order Details].OrderID),0) AS ZeroOne
FROM Products INNER JOIN (Orders INNER JOIN [Order Details] ON Orders.[OrderID] = [Order Details].[OrderID]) ON Products.ProductID = [Order Details].ProductID
WHERE ((([Order Details].OrderID)=177496))
ORDER BY [Order Details].OrderDetailID;
Resulting in
AqryOrderDetailsAqryOrderDetails

OrderDetailIDOrderIDProductNameQuantityZeroOne
298515​
177496​
BOTTLE SF MALDON GOLD 500ML
12​
0​
298516​
177496​
BOTTLE SF CAPTAIN BOB 500ML
12​
0​
298517​
177496​
BOTTLE SF OLD MAN & THE SEA 500ML
12​
0​
298518​
177496​
BOTTLE SF KINGS 500ML
12​
0​
298519​
177496​
BOTTLE SF OSCAR WILDE 500ML
12​
0​
298520​
177496​
BOTTLE SF GORGEOUS GEORGE 500ML
12​
1​
298521​
177496​
BOTTLE SF BINGLE JELLS 500ml
48​
1​
298522​
177496​
BOTTLE SF WONKY DONKEY
48​
1​
298523​
177496​
BOTTLE SF TOP HAT PORTER
48​
1​
298524​
177496​
GIFT BOX EMPTY
50​
1​

Now add text boxes to the main report with control sources of =0 and =1 that can be used in the Link Master/Child properties. You would need to make the subreport a single column and add a hidden text box with the ZeroOne value.
1737855159836.png

1737855193479.png
Results in Report View. When finished, hide the 0 and 1 text boxes.
1737855232897.png
 
Last edited:
Thank you so much, Duane, these explain everything and will save my client a lot of print paper.

I wasn't aware of the difference between Print Preview and Report View even though you'd mentioned it. I'd been looking at your Testing SubReport Height sample database and couldn't replicate getting 2 columns until seeing the Default View options. It's all now clear.

I'll have a good look at your alternative with split subreports. Near freezing here but managed 25 miles on bike this morning.
 

Part and Inventory Search

Sponsor

Back
Top