Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using AbsolutePosition

Status
Not open for further replies.

Deltaflyer

Programmer
Oct 11, 2000
184
GB
Hiya all,

I am using the following code to open my dbs and want to use the rs.absoluteposition as a marker,

a = Dir("calllog.mdb")
Set db = Workspaces(0).OpenDatabase(a)
strSQL = &quot;SELECT top 1 * FROM log WHERE status < 3 order by logid&quot;
Set rs = db.OpenRecordset(strSQL)

Notes.Text = rs.AbsolutePosition


However the Notes.Text value is always returning a value of zero. How do i make the rs.absoluteposition work properly?

Thanks DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
the property absolutposition is at disposal only for dynaset and and snapshot recordset.
If you don't specify the type the default is forwardonly.
Try using
Set rs = db.OpenRecordset(strSQL,dbOpenDynamic)
Stevie B. Gibson
 
Thanks for the swift reply Stevie but,

Set rs = db.OpenRecordset(strSQL, dbOpenDynamic)

is returning a

Run Time Error-3001, Invalid Argument

Any other ideas??

DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
It's strange, is a documented option of the DAO openrecordset method.
Code:
Set rs = db.OpenRecordset(strSQL, 16)

works?

Stevie B. Gibson
 
Hiya,

I have tried putting 16 instead of dbOpenDynamic and it is still not allowing me access.

DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
OK, you're right...I'm stupid :) (I don't say you why :) )
use dbOpenSnapshot (4)
or dbOpenDynaset (2)

depending on your needs. Stevie B. Gibson
 
I have used {color blue]2[/color] and 4 and that works fine but i still cannot use the AbsolutePosition, it is still returning zero. DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
I noticed a thing. You don't move to a record after opening the recordset. Absolut position is zero based. It's possible that is zero 'cause you are on the first record? Stevie B. Gibson
 
Sorry my mistake, i have a rs.movefirst just before i ask for the rs.absoluteposition, must have forgotten to retype it on the post. DeltaFlyer ;-)

DeltaFlyer - The Only Programmer To Crash With Style.
 
yes but the first record has absoluteposition = 0 Stevie B. Gibson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top