Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Finding the end of a recordset

Discussion in 'Information Technology' started by CLamar, Jul 28, 2006.

  1. CLamar

    CLamar
    Expand Collapse
    Guest

    How do you find the end of a recordset, so it can be used in a loop. I tried
    the EOF command but it wont enter the loop when i use it. Here is an example
    of the code. The second for loop with the * is the one giving me problems

    Set Recordset = New ADODB.Recordset
    With Recordset
    Src = "SELECT * FROM Table1"
    .Open Source:=Src, ActiveConnection:=Connection

    For Col = 0 To Recordset.Fields.Count - 1
    Sheets("DataTable").Range("A1").Offset(0, Col).Value =
    Recordset.Fields(Col).Name
    Next

    Sheets("DataTable").Range("A1").Offset(1, 0).CopyFromRecordset
    Recordset

    ** For Row = 2 To Recordset.EOF
    Sheets("Sheet1").LstBatchnum.AddItem
    Sheets("DataTable").Cells(Row, 1)
    Next Row
    End With

    Thanks
     
  2. Loading...

    Similar Threads Forum Date
    Legal Finding the balance. Gender and judging in India's Appellate Court Breaking News Nov 7, 2010
    Difficulty Finding Raag Gurmat Sangeet Tanti Saaj Nitnem Audio And Video Gurmat Sangeet Jan 13, 2017
    The Salmon Story, Finding Home Sikh Sikhi Sikhism Jul 29, 2016
    Sikhi Guru Nanak's Methodology Of Finding Truth Sikh Sikhi Sikhism Jan 1, 2016
    Movies Ashdoc's movie review---Finding Fanny ( English version ) Theatre, Movies & Cinema Sep 15, 2014

  3. Arthur

    Arthur
    Expand Collapse
    Guest

    >** For Row = 2 To Recordset.EOF


    use this instead
    For Row = 2 To Recordset.RecordCount -1
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page