Solved

Data from ListBox to DataReport

Posted on 2003-10-25
3
268 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now