I am using the code from Paul Lefebvres example of a Printable List Box (included in the example apps) so I can print in a report in multiple columns of basically the same date. The data is loaded from a recordset. The first 40 records are loaded into Column 0. The next 40 records are loaded into Column 2., etc I use the code below to load the list box.
[code]Dim X as Integer
X = 0
Dim Row as Integer
Dim Col as integer
While Not rs.eof
X = X + 1
If X = 41 Then Col=1 Row=0 Elseif X = 81 Then Col=2 Row=0 Elseif X = 121 Then Col=3 Row=0 Elseif X = 161 Then Col=4 Row=0 Elseif X = 201 Then Col=5 Row=0 End If txtMember.Text=(rs.Field("Members").StringValue) List1.AddRow List1.Cell(Row, Col)=txtMember.Text rs.MoveNext Row=Row + 1
That works great in filling the list box with the correct data from the database.
I then use this code to print the contents of the List Box in a Report:
[code] Dim rpt As New ReportRoster
Dim rsq as new Reports.RecordSetQuery(rs)
//Adjusts Printer Resolution
dim ps as new printersetup
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300
Dim g As Graphics
g = OpenPrinterDialog(ps, Nil)
If g <> Nil Then
If rpt.Run(frmRosters.PrintableListBox, ps) Then
If rpt.Document <> Nil Then
That will print correctly, but the problem is that I get an extra page for each column that is filled up with the Listbox. So if the Listbox has 3 columns, I get three pages that want to print. The first page is what it should look like, with the second two pages being blank.
I was wondering if there was a way (In Code) that I can tell the app just to print the first page, since there will never be enough data to print more than one page?
Any help would be greatly appreciated.