Hi, i have a table in the database and when i run the query "SELECT Variety From StockSummary" there will be 5 rows of variety. my problem is that, in my code at vb6, it can only display the first row of the "Variety" fields..
here is my code:
frmForm.Controls("Label1").Caption = rs.Fields("Variety")
I am new with vb6, can anyone have any suggestion on how should I changed my code that will display all the "Variety" in the label?
I have try to use loop:
Do While Not Dbacc.rs.EOF
frmTest.Controls("Label1").Caption = rs.Fields("Variety")
Loop
but there is problem with "Dbacc.rs.EOF" which is "Compile error: method or data member not found! "
2 Replies - 5330 Views - Last Post: 30 April 2011 - 02:06 PM
#1
How to display row set of access db in vb6 using label?
Posted 28 April 2011 - 12:18 AM
Replies To: How to display row set of access db in vb6 using label?
#2
Re: How to display row set of access db in vb6 using label?
Posted 28 April 2011 - 12:32 AM
bongskei, on 28 April 2011 - 12:18 AM, said:
Hi, i have a table in the database and when i run the query "SELECT Variety From StockSummary" there will be 5 rows of variety. my problem is that, in my code at vb6, it can only display the first row of the "Variety" fields..
here is my code:
frmForm.Controls("Label1").Caption = rs.Fields("Variety")
I am new with vb6, can anyone have any suggestion on how should I changed my code that will display all the "Variety" in the label?
I have try to use loop:
Do While Not Dbacc.rs.EOF
frmTest.Controls("Label1").Caption = rs.Fields("Variety")
Loop
but there is problem with "Dbacc.rs.EOF" which is "Compile error: method or data member not found! "
here is my code:
frmForm.Controls("Label1").Caption = rs.Fields("Variety")
I am new with vb6, can anyone have any suggestion on how should I changed my code that will display all the "Variety" in the label?
I have try to use loop:
Do While Not Dbacc.rs.EOF
frmTest.Controls("Label1").Caption = rs.Fields("Variety")
Loop
but there is problem with "Dbacc.rs.EOF" which is "Compile error: method or data member not found! "
here is my datasource for the access database:
Set rs = Dbacc.GetData("SELECT Variety From StockSummary;")
Set rptOPREP.DataSource = Dbacc.GetData("Select * From PrintTemp")
#3
Re: How to display row set of access db in vb6 using label?
Posted 30 April 2011 - 02:06 PM
Assuming dbAcc is an ADO Data control: dbacc.rs.EOF needs to be dbacc.Recordset.EOF. And, you also have to add the new variety value to the existing ones. Presently, you aren't doing that, you're overwriting.
Page 1 of 1