Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Data from ListBox to DataReport

Posted on 2003-10-25
3
Medium Priority
?
301 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 500 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…
Suggested Courses

618 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