Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    395

    Unanswered: list box is not displaying

    I have a list box getting a filtered recordset from a stored procedure using ADO calling in VB6.
    The recordset returns the two records with correct values. The problem is it is not displaying in the list box. Why? I tried using .additem property but it is not available in Access 2000. Can anyone help me with this? Thanks!

    Function ..
    Dim rs_get_defect_desc As New ADODB.Recordset, lot_n as integer
    Set lot_n = 4051

    Rs_get_defect_desc.Open "EXEC spGet_desc_defect @lot_n=" & lot_n, CurrentProject.Connection
    Do While Not rs_get_defect_desc.EOF

    lstbox.RowSource = rs_get_defect_desc(0) & " " & rs_get_defect_desc(1)
    rs_get_defect_desc.MoveNext

    Loop

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    How is your combobox set up ?

    How many columns ?

    What is the bound column ?

    Your line:

    lstbox.RowSource = rs_get_defect_desc(0) & " " & rs_get_defect_desc(1)

    should be:

    lstbox.RowSource = lstbox.RowSource & rs_get_defect_desc(0) & " " & rs_get_defect_desc(1) & ";"

    and then you should truncate the trailing ";"

  3. #3
    Join Date
    May 2002
    Posts
    395

    list box not displaying

    Originally posted by PracticalProgram
    How is your combobox set up ?

    How many columns ?

    What is the bound column ?

    Your line:

    lstbox.RowSource = rs_get_defect_desc(0) & " " & rs_get_defect_desc(1)

    should be:

    lstbox.RowSource = lstbox.RowSource & rs_get_defect_desc(0) & " " & rs_get_defect_desc(1) & ";"

    and then you should truncate the trailing ";"
    Hi,

    Here are the properties for lstbox in Access:
    Control source: blank
    Row Source: blank
    Column count: 2
    Bound Column: 1

    I need to send in a parameter(lot_n) to the stored procedure as the criteria for the recordset. In VB6 I called sp and the correct number of records returned and so are the fields. I walked through the loop the values in lstbox.rowsource. But they are Not displaying in the list box. It’ll work if the Select statement is in Row Source property but I need to pass in parameter for the criteria so I need to write in VB. I also tried assigning Select statement to the rowsouce.

    Str = SELECT tblRMR_desc_defects.num_defects, ... FROM tblBag_results INNER JOIN tblRMR_desc_defects "
    str = str & " ON tblBag_results.bag_results_id = tblRMR_desc_defects.bag_results_id INNER JOIN tblPart_defects"
    str = str & " ON tblRMR_desc_defects.part_defect_id = tblPart_defects.part_defect_id"
    str = str & " WHERE tblBag_results.lotnum = lot_n;"

    lstbox.RowSource = str

    But it is still not working. I really appreciate any help.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •