Solved

Data from ListBox to DataReport

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

867 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

16 Experts available now in Live!

Get 1:1 Help Now