|
-
Nov 30th, 2002, 07:25 PM
#1
Thread Starter
Junior Member
recordset: Why does it only display the last record?
on button click event:
dim atext as string
atext=text1.text
rs.Open "SELECT Name,Address,Category FROM tbl_sample WHERE Name='" & atext & "' ORDER BY Name", cn
rs.MoveFirst
Do Until rs.EOF = True
Text2.Text = rs!Name & vbCrLf & rs!Address & vbCrLf & rs!Category & vbCrLf & vbCrLf
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
there are a total of 5 records/rows.
but the text2 box only displays the last one.
i suspect the problem is in the loop.
pls help. thanks.
-
Nov 30th, 2002, 07:51 PM
#2
Your current statement is just overwriting the textbox with the data from each record. You need to concatenate each row to the textbox same as you do with each field.
Text2.Text = Text2.Text & rs!Name & vbCrLf & ...
You might want to clear the Textbox before your loop begins.
-
Dec 1st, 2002, 03:47 PM
#3
Lively Member
And make sure you have multiline set to true in your textbox.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|