Solved

Data from ListBox to DataReport

Posted on 2003-10-25
3
281 Views
Last Modified: 2010-05-01
Hello!
Can anyone please tell me how I can get the data, that a user writes as input to a listbox, into a textbox in my data report. The listbox can have several lines depending on how many lines the user gives as input. I need every line in my datareport. After the line is written into a textbox you add it to the listbox with a button. Is it possible to add the line to the RptTextBox with the same button as to the listbox. I haven't done the program, so I really don't know how the listbox works... You could say I'm quite lost.

I hope someone understood something? This is my first time using a listbox, I know how to get the data from a textbox to the report. What do I have to do different? A short example of the code could help me.

Thank You in advance!
0
Comment
Question by:Henrikä
3 Comments
 

Author Comment

by:Henrikä
ID: 9620748
I was just trying to solve my problem with the listbox and managed to store the content of the last input in a variable. That way I got a part of the data I need to the datareport. Is there a way to store everything that is given as input in different variables? I guess this is not the smartest way of doing this. Could someone please help me?
0
 
LVL 3

Accepted Solution

by:
gafoorgk earned 125 total points
ID: 9621809
use the method following. u have to reference 'Microsoft ActiveX Data Objects 2.x'

Public Sub ShowReport()
    Dim rsTemp As ADODB.Recordset
    Dim i As Integer
   
    '// Create a temperory recordset and fill listbox items in that recordset
    Set rsTemp = New ADODB.Recordset
    With rsTemp
        With .Fields
            .Append "Field1", adVarChar, 64, adFldIsNullable
        End With
        .Open
       
        For i = 0 To List1.ListCount - 1
            .AddNew Array("Field1"), Array(List1.List(i))
        Next i
    End With
   
    '// Set datasource of the report to temperory recordset
    '// and set 'Text1' (rptTextBox) to show contents of Field1
    With DataReport1
        Set .DataSource = rsTemp
        With .Sections("Section1").Controls
            .Item("Text1").DataField = "Field1"
        End With
        .Show
    End With
End Sub

i hope this is enough
0
 

Expert Comment

by:nvenho
ID: 9622075
Thanks for your help!
I still have a problem getting all lines from the listbox to the textbox. The rptTextBox only shows the first line that is given as input. Should I use several rptTextBoxes or how can I solve this problem?
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question