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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying entire column of data into text box

Status
Not open for further replies.

FinnMan

Technical User
Feb 20, 2001
75
US

Having a little trouble here.... :-(

I'm trying to display an entire column of data from an access table into a text box. I can hit the first record and even jump between them but can't seem to populate the entire text box with the column of data. Any suggestions?
 
Make the data from the column a single string and add a vbCrLf between lines then set the textbox text to the string. Assuming you are using ADO:

Do Until rs.EOF
rs.Open
rs.MoveFirst
str = rs("columnName") & vbCrLf
rs.MoveNext
Loop

rs.Close

text1.Text = str

Also make sure you set the textboxes multi-line property to true. Hope this helps. [spin] If you choose to battle wits with the witless be prepared to lose.
[machinegun][hammer]
 
Thx for the info, I think I'm getting the idea now...but no, I'm not using ADO. Struggling with the proper syntax for a non-ado query....Suggestions appreciated and very welcome :)
 
Got it!! :)

Used the following:

Private Sub Form_Load()
Dim list As String
Set dbs = OpenDatabase("data.mdb")
Set rstList = dbs.OpenRecordset("Sheet1", dbOpenTable)
Do Until rstOrders.EOF = True
list = list & rstOrders("Column2") & vbCrLf
rstList.MoveNext
Loop
rtbList.Text = list
End Sub


Thx for getting me on the path [2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top