Solved

Data from ListBox to DataReport

Posted on 2003-10-25
3
291 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ä
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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