Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query returns columns to be displayed in a list box not working 1

Status
Not open for further replies.

vamoose

Programmer
Oct 16, 2005
320
MX
I am Using Access 2000. I have form that runs a query when opened which returns 12 columns in 1 row worth of data, the query is working fine. I am trying to display the column values in a list box but all that shows up is the first columns data. Is there a "trick" to get this horizontal data displayed vertically in a text box ?

Thank you to all.
 
The best bet would be to build a value list from the record.


Code:
For i=0 To rs.Fields.Count-1
strValList = strValList & ";" & rs.Fields(i)
Next
Me.cboCombo.RowSource=Mid(strValList,2)

Or there abouts.
 
This is a new one to me. Do I still need the query or does this code perform that function ?

Table name = SameAs
Column names = SA1 thru SA12, the data which I need displayed
Query name = Query1
List box name = Daughter

Thanks for the assistance.
 
Yes, you still need the query opened as a recordset. The snippet I posted is the "trick" to get this horizontal data displayed vertically in a text [blue]list[/blue] box ?

Don't forget to change the Row Source Type to Value List.
 
Is this correct so far ?

The Daughter List Box Row Source Type is set to Value List
The Daughter Row Source is set to Query1
 
The Daughter Row Source is set programmatically to strValList (see my snippet).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top