Subject: page break
Posted By: pab006 Post Date: 12/16/2003 7:36:57 AM
Hi,
Ive created a table that groups together records into a particular order. For printing purposes is it possible to force the system to print each "group" on a seperate sheet of paper, even though it will appear as one list on the screen. Is it is possible can some one tell me how?

many thanks

Reply By: Jonax Reply Date: 12/16/2003 7:42:30 AM
Yup, have a look here:
http://p2p.wrox.com/topic.asp?TOPIC_ID=7160

Reply By: pab006 Reply Date: 12/16/2003 9:36:55 AM
Ive tried this, it creates the break after each record. The record are displayed in this format

number    name    type
1         fred    electrical
2         bob     electrical
3         ted     mechanical
4         geaorge mecahnical
5         ste     mechanical

each time the type changes i need this prinitng on a seprate page. Is this possible, or do i have to group the records in a different way on the screen/ within asp

Reply By: Jonax Reply Date: 12/16/2003 10:29:22 AM
It certainly is possible - show me your code and I'll fix it for you...

Reply By: planoie Reply Date: 12/16/2003 10:35:59 AM
Perhaps you are setting the break after each new "number" which would certainly make it break for every record.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply By: pab006 Reply Date: 12/16/2003 11:17:12 AM
Here is the code that displays my results

<p class="centered">Below is a list of faulty machines for week <%= week_no %>.<br />Carry out <a class="report" href="maintenance_report.asp">another search</a>.</p>

    <table border="1"align="center" cellspacing="0" cellpadding="2" bordercolordark="#CCCCCC" bordercolorlight="#FFFFFF" width="600">
      <tr>
        <td align="center"><strong>Date</strong></td>
        <td align="center"><strong>Clock No.</strong></td>
        <td align="center"><strong>Shift</strong></td>
        <td align="center"><strong>Machine</strong></td>
        <td align="center"><strong>Fault Type</strong</td>
        <td align="center"><strong>Fault Description</strong</td>
        <td align="center" width="100"><strong>Comment</strong></td>
      </tr>
    <%
       Do While Not RSlist.EOF
    %>
      <tr>
        <td align="center"><%= Rslist("MaintenanceDate") %></td>
        <td align="center"><span class="help" title="<%= Rslist("Initial") %>. <%= Rslist("Surname") %>"><%= Rslist("ClockNo") %></span></td>
        <td align="center"><%= Rslist("Shift") %></td>
        <td align="center"><%= Rslist("MachineNo") %></td>
        <td align="center"><%= Rslist("FaultType") %></td>
        <td align="center"><%= Rslist("Fault") %></td>
        <td align="left"><%= Rslist("Comments") %></td>
      </tr>
      <%
          RSlist.Movenext
        Loop

        Rslist.close
      %>
    </table>
thanks

Reply By: pab006 Reply Date: 12/16/2003 11:17:57 AM
forgot to add, ive taken the page break out of this code, so its back to how it began. any help is greatly appreciated

Reply By: Jonax Reply Date: 12/16/2003 11:26:41 AM

<%
dim sLastType
%>
<p class="centered">Below is a list of faulty machines for week <%= week_no %>.<br />Carry out <a class="report" href="maintenance_report.asp">another search</a>.</p>

    <table border="1"align="center" cellspacing="0" cellpadding="2" bordercolordark="#CCCCCC" bordercolorlight="#FFFFFF" width="600">
      <tr>
        <td align="center"><strong>Date</strong></td>
        <td align="center"><strong>Clock No.</strong></td>
        <td align="center"><strong>Shift</strong></td>
        <td align="center"><strong>Machine</strong></td>
        <td align="center"><strong>Fault Type</strong</td>
        <td align="center"><strong>Fault Description</strong</td>
        <td align="center" width="100"><strong>Comment</strong></td>
      </tr>
    <%
       Do While Not RSlist.EOF
        If sLastType <> "" AND sLastType <> Rslist("FaultType") then
            response.write "<tr style=""page-break-before: always;"">"
            sLastType = Rslist("FaultType")
        Else
            response.write "<tr>"
        End if
    %>
      <tr>
        <td align="center"><%= Rslist("MaintenanceDate") %></td>
        <td align="center"><span class="help" title="<%= Rslist("Initial") %>. <%= Rslist("Surname") %>"><%= Rslist("ClockNo") %></span></td>
        <td align="center"><%= Rslist("Shift") %></td>
        <td align="center"><%= Rslist("MachineNo") %></td>
        <td align="center"><%= Rslist("FaultType") %></td>
        <td align="center"><%= Rslist("Fault") %></td>
        <td align="left"><%= Rslist("Comments") %></td>
      </tr> 
      <%
          RSlist.Movenext
        Loop

        Rslist.close
      %>
    </table>


Reply By: Jonax Reply Date: 12/16/2003 11:28:33 AM
BTW: I'm assuming your results are sorted by the Fault Type...

Reply By: pab006 Reply Date: 12/16/2003 11:37:56 AM
yes, thats great, thankyou for all your help,

Reply By: Jonax Reply Date: 12/16/2003 11:39:56 AM
There's a logical error in the above...
Change it to this:


        If sLastType = "" Then
            response.write "<tr>"
            sLastType = Rslist("FaultType")
        ElseIf sLastType <> Rslist("FaultType") then
            response.write "<tr style=""page-break-before: always;"">"
            sLastType = Rslist("FaultType")
        Else
            response.write "<tr>"
        End if


Reply By: Jonax Reply Date: 12/16/2003 11:41:44 AM
BTW: You are missing a space in

<table border="1"align="center"


Reply By: pab006 Reply Date: 12/17/2003 5:37:55 AM
that worked a treat, many thanks again


Go to topic 7693

Return to index page 984
Return to index page 983
Return to index page 982
Return to index page 981
Return to index page 980
Return to index page 979
Return to index page 978
Return to index page 977
Return to index page 976
Return to index page 975