How to return multiple columns from a single column table?

M

Mota

Hello;
I have a table having 2 fields:DID,dName.Although DID is a unique field,the
table's PK and a Long accending number,but its numbers are not followingly.I
mean the 8th record may have DID=8 but for the 9th record DID=10 and for the
10th one DID=17.There is a report based on this table that prints products
label.Each label contains a DID and a dName.Each label width is about 1/3 of
an A4 paper width.So it wastes the papers.I want to bind report to a query
that can put each 3 records of this table as 1 record containing 2*3
fields.Then i can put that 3 fields in 1 grid of report,so print 3 label in
one grid,instead of 1 label in 1 grid.
Example:
What i have in the table,named MainTBL: (Data are just for test)
--------------
DID dName
1 ABC
2 DEF
3 GHI
5 JKL
6 MNO
9 PQR

What I need (The query must return):
--------------------------------------------
DID dName DID2 dName2 DID3 dName3
1 ABC 2 DEF 3 GHI
5 JKL 6 MNO 9 PQR

Is that possible?If yes,what would be the SQL statement of this query?
Thank you so much for your help.
 
A

Allen Browne

Mota, there is a much simpler way to get Access to print 3 labels across
your report. Just tell it to use 3 columns on your report.

The Label Wizard can create the report for you. If you want to calculate it
yourself:
1. Create a new report (Design view) based on this query.

2. In Report Design view, choose Page Setup on the File menu.
Measure the 4 margins on your label sheet.
Set the Left, Right, Top, and Bottom margins on the first tab of the dialog.
(Don't close the Page Setup dialog yet.)

3. On the 3rd tab of the Page Setup dialog, set:
Number of Columns: 3
Row Spacing: 0
Column Spacing: Same value as left and right margins.
Close the dialog, leaving the Column Size as it is (i.e. with the "Same As
Detail" box checked.")

4. Calculate the width of your report. It will be:
Paper Width - Left Margin (LM) - Right Margin (RM) - 2 x Column Spacing (CS)
The actual page layout looks like this:
| LM | Label 1 | CS | Label2 | CS | Label 3 | RM |
Example: 8.5" paper, with 0.5" margins and column spacing leaves 6.5" to be
divided amongst 3 labels, so 2.16" each. Set the Report Width to 2.16" in
the Properties dialog.

5. Measure the distance from the top of one label to the top of the next on
your sheet of labels. Set the Height of the Detail section to match.

6. The labels are fixed height, so make sure the Can Shrink and Can Grow
properties of the Detail section are No. (If you set Can Shrink or Can Grow
for text boxes in the section, Access is likely to set the properties for
the section also, and you must change them back to No.)
 
M

Mota

Now will try it.Thank you for ur help.

Allen Browne said:
Mota, there is a much simpler way to get Access to print 3 labels across
your report. Just tell it to use 3 columns on your report.

The Label Wizard can create the report for you. If you want to calculate
it yourself:
1. Create a new report (Design view) based on this query.

2. In Report Design view, choose Page Setup on the File menu.
Measure the 4 margins on your label sheet.
Set the Left, Right, Top, and Bottom margins on the first tab of the
dialog.
(Don't close the Page Setup dialog yet.)

3. On the 3rd tab of the Page Setup dialog, set:
Number of Columns: 3
Row Spacing: 0
Column Spacing: Same value as left and right margins.
Close the dialog, leaving the Column Size as it is (i.e. with the "Same As
Detail" box checked.")

4. Calculate the width of your report. It will be:
Paper Width - Left Margin (LM) - Right Margin (RM) - 2 x Column Spacing
(CS)
The actual page layout looks like this:
| LM | Label 1 | CS | Label2 | CS | Label 3 | RM |
Example: 8.5" paper, with 0.5" margins and column spacing leaves 6.5" to
be divided amongst 3 labels, so 2.16" each. Set the Report Width to 2.16"
in the Properties dialog.

5. Measure the distance from the top of one label to the top of the next
on your sheet of labels. Set the Height of the Detail section to match.

6. The labels are fixed height, so make sure the Can Shrink and Can Grow
properties of the Detail section are No. (If you set Can Shrink or Can
Grow for text boxes in the section, Access is likely to set the properties
for the section also, and you must change them back to No.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top