2 Replies - 3072 Views - Last Post: 30 April 2011 - 02:06 PM Rate Topic: -----

#1 bongskei  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 16-April 11

How to display row set of access db in vb6 using label?

Posted 28 April 2011 - 12:18 AM

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! "

Is This A Good Question/Topic? 0
  • +

Replies To: How to display row set of access db in vb6 using label?

#2 bongskei  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 16-April 11

Re: How to display row set of access db in vb6 using label?

Posted 28 April 2011 - 12:32 AM

View Postbongskei, 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 datasource for the access database:

Set rs = Dbacc.GetData("SELECT Variety From StockSummary;")
Set rptOPREP.DataSource = Dbacc.GetData("Select * From PrintTemp")
Was This Post Helpful? 0
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,985
  • Joined: 19-May 09

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1