Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 26th, 2006, 10:36 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default move to particular record number in recordset

Hello friends,

I need to move to a particular record number in a record set (for eg: 300th record in a recordset of 450 records) and then carryout certain calculations from the 300th record till the last record.How can this be achieved. (I am using dao 3.6 object library).
I tried the string find method but it did not work out. Any suggestions?
Thanx for the help

 
Old June 27th, 2006, 06:34 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

try using
rs.AbsolutePosition = <record pointer long number>

When you set this the record pointer is positioned to the number what you assign
intenally, so you can say move next there to move the pointer to next record
like 300th to 301.

Hope this helps

With Regards,
Raghavendra Mudugal
 
Old June 27th, 2006, 03:03 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

You can also use:
Code:
    rs.MoveFirst
    rs.Move 300
    If you don’t know which record you are after, and .Find doesn’t work, and .Seek doesn’t work, you can do it the hard way:
Code:
    rs.moveFirst
Code:
    Do While True
        If rs!TestField = TestValue Then Exit Do
        rs.MoveNext
        If rs.EOF then Exit Do
    Loop
    (Pretty ugly, but sometimes you just need to grab a recordset by the throat and have your way with it...)
 
Old June 27th, 2006, 09:11 PM
Registered User
 
Join Date: Jun 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanx guys, the .absoluteposition did not work with dao3.6 error msg"this funtion not suported by the object".However the move first,move 300 and the subsequent suggestion of "catching the record by the throat" certainly helped.Thanx for helping out guys. Bye






Similar Threads
Thread Thread Starter Forum Replies Last Post
move record to another table in same DB Dejitan Classic ASP Basics 2 January 3rd, 2007 07:50 AM
move through a recordset with next and previous. peterB Access VBA 8 February 22nd, 2005 03:48 PM
total number of rows in a recordset lian_a Classic ASP Basics 2 February 8th, 2005 08:13 AM
How to move next Record qazi_nomi Classic ASP Basics 5 August 13th, 2004 05:19 PM
How to get number of records in recordset Ciarano VB How-To 6 March 3rd, 2004 10:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.