Multi Column Report - Limited to 20 columns - Needs more

cpremo

Registered User.
Local time
Yesterday, 20:52
Joined
Jun 22, 2007
Messages
50
I've created a report that fits on a Legal sheet of paper. I use the code below to "stuff" the data into the report. Unfortunately, I'm limited to 20 columns. Is there a way to print another set of 20 and then a nother set of 20, etc. until I reach the EOF for my record set. I have may users of the database that have more than 20 records and they can't run the report for those records above the first 20.

(I've attached a stripped down version of my database. Only contains the necessary data, queries and report.)

Code:
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_Report_Open
    Dim rst As ADODB.Recordset
    Dim fld As ADODB.Field
    Dim ctl As Control
    Dim X As Integer
    
    Set rst = New ADODB.Recordset
    rst.Open "[Server NLM Files_Crosstab]", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
    
    With rst
        For Each fld In rst.Fields
            For Each ctl In Me.Controls
                If TypeOf ctl Is TextBox And ctl.Name = X Then
                    If fld.Name = "NLM Name" Then
                        X = X - 1
                    End If
                    ctl.ControlSource = fld.Name
                    Exit For
                ElseIf TypeOf ctl Is Label And Right(ctl.Name, 2) = X Then
                    ctl.Caption = fld.Name
                End If
            Next ctl
            X = X + 1
        Next fld
    End With

Exit_Report_Open:
    Exit Sub

Err_Report_Open:
    MsgBox Err.Description & "  -  " & Err.Number
    Resume Exit_Report_Open
    
End Sub
 

Attachments

Last edited:
So, there's no way to "cycle" through the report again for the next set of 20???
 
OK. How about if I place a call to a module in the server name field and use the following. Shouldn't it give me the string value of all the servers selected? Unfortunately it doesn't. What am I doing wrong?????

Code:
 Dim frm As Form, ctl As Control
    Dim varItm As Variant

    Set frm = Forms!MainMenu
    Set ctl = frm!ServerList
    For Each varItm In ctl.ItemsSelected
        Dim strServers As String
        strServers = ctl.ItemData(varItm) & " or "
        Exit Function
    Next varItm
        strServers = strServers & " test"
 
OK, I've added a way to access the underlying CrossTab Query so the user can export out the raw data. However, if someone can/is willing to take a look at the database attached to the first post and give me some assistance in changing the report selection to look back at the ServerList listbox and allow the user to select several (upto the 20 limit) servers and report on those servers.
 

Users who are viewing this thread

Back
Top Bottom