Datasheet View position detection

G

Guest

Access 2003:

In a form displaying a group of records in datasheet view there is a
need to track the location of the cursor relative to the first
displayed record.


It it possible to detect the location without having to keep constant
tract of the relative position of all records and using the bookmark to
move the cursor to the correct location.


Thanks in advance for your suggestions.
 
G

Guest

You could use Me.Recordset.AbsolutePosition to find the record number. This
is zero-based, so the first record is number 0.

Barry
 
G

Guest

Thanks for your reply Gilbert,

The recordset absolute would give me a number relative to the beginning of
the recordset taking into account the specified order. What I need is the
location of the cursor in the viewable datasheet window. The first recordset
record many not be the first displayed record if the number of records to be
displayed is greater than the number of visible records in the datasheet view
and the cursor has gone beyond the bottom to scroll the records up.

The information required would have to be related to the datasheet wouldn't
it it?
 
G

Guest

Thanks for your response and your example.

I guess you can only go so far with native VBA without involving the windows
API. Your solution is effective and precise Stephen.

For now what my application needs is to keep the cursor in one place even
though the underlying form recorset is being updated by potentially inserting
and deleting records including the one the cursor is on.

This can be achieved by being careful with form refresh and requery after
updates and using the recordset and form bookmark property together.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top