Best way to list an array in a report?

Banana

split with a cherry atop.
Local time
Today, 15:46
Joined
Sep 1, 2005
Messages
6,318
After looking around, I'm not 100% sure how I want to approach this.

I have a report which is essentially a identification form for our paperworks, based on a form in the database. Now, the form (in database) has two multi-select listbox, and I need to return all selections from each listboxes for a given client.

I'm given to understand that report cannot handle recordset which would prevent me from simply dropping it in the report. I've fiddled with unbound textbox, but not with much result as it usually creates the report to come blank.

In the table containing the selections from multiselect listboxes, it's something like

tblListboxSelection
ID
ClientID
SelectionID

tblListboxLookup
SelectionID
SelectionName

I then can make a query that will display

ClientID | SelectionName

But in report, I only need

***Top of page***

ClientID

Blah blah blah

_____________________________________________________________
SelectionName(0) SelectionName(1) SelectionName (2) |
SelectionName(3) SelectionName(4) SelectionName (5) |
---------------------------------------------------------------------

***Bottom of page***

How would I achieve this goal?

TIA.
 
Last edited:
Here is my code at the present.

Code:
Dim i As Variant
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim qd As DAO.QueryDef
    Dim cRecount As String
    
    Set dbs = CurrentDb
    
    Set rst = dbs.OpenRecordset("qtrThatQuery")

With rst

    If .recordcount <> 0 Then
        .MoveFirst
        Do Until .EOF
            cRecount = cRecount & ", " & rst![FieldName]
            .MoveNext
        Loop
    Me.txtBox= cRecount
    End If
End With

At the line where cRecount is inserted, I get an error saying I cannot insert this value in the textbox.

What happened?

Edit: Instead of inserting this in OnOpen event, I used OnFormat event of the section where textbox is and it works. Thanks.
 
Last edited:
=Count(*) in an unbound textbox on the Report would give the same result and more efficiently
 
Rich, I've tried the Count(*), but that only gives me numeric total, not necessarily the text strings concentated together. :confused:
 

Users who are viewing this thread

Back
Top Bottom