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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Even Report Columns

Status
Not open for further replies.

acv111

Technical User
Oct 21, 2005
3
US
I am trying to create a report with two columns that display customer name and address. I have the column layout setup as Down, then Across. Is there a way to even out the number of customer names and addresses in each column without changing the column layout to Across, Then Down. For example, if their are four customer addresses is it possible to display two in the first column and two in the second column? Thanks.
 
Hi
You may find the germ of an idea here:
Code:
Sub EvenColumns()
'Set NewRolOrColumn to After Section for Divider Group Footer
Dim NoAdrPerPage, RecCount
Dim rs As Recordset

Set rs = CurrentDb.OpenRecordset("Select * from members order by lastname")
'Choose the number of addresses per standard page
NoAdrPerPage = 16

'Get the number of records
RecCount = rs.RecordCount
If RecCount > 16 Then
'Number left over after standard page
    rs.MoveLast
    rs.Move -(RecCount Mod 16) / 2
Else
'Not enough for more than one page
    rs.Move RecCount / 2
End If
'Using Lastname<=rs!Lastname as Divider gives either -1 or 0
strSQL = "SELECT FirstName, LastName, [lastname]<='" & rs!LastName _
    & "' AS Divider FROM members ORDER BY LastName;"
DoCmd.OpenReport "Members", acViewDesign
Reports("Members").RecordSource = strSQL
DoCmd.OpenReport "Members", acViewPreview

End Sub
 
You can calculate a column in the subreport's record source that changes the order:
RecordSeq CalcSeq
1 1
2 3
3 2
4 4

Sort on the calculated sequence as across then down which is actually the RecordSeq down then across.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top