Identify the first visible record in a continous fofr

G

Gianluca

Is there a way to determine by code what record is currently the uppermost
visible record in a continuous form?
Me.SelTop return the selected record.
But I need the user to select a record and the vba code
to know both the selected record and the first visible record of the form.

-I need to do some operations, update some records
- requery the form
- positioning the form so that the first visible record is
the same first record before my operations

Is there a way to do this ?
Thanks in advance
Gianluca
 
J

Jonathan Parminter

Gianluca said:
Is there a way to determine by code what record is currently the uppermost
visible record in a continuous form?
Me.SelTop return the selected record.
But I need the user to select a record and the vba code
to know both the selected record and the first visible record of the form.

-I need to do some operations, update some records
- requery the form
- positioning the form so that the first visible record is
the same first record before my operations

Is there a way to do this ?
Thanks in advance
Gianluca

Hi Gianluca,

use the following as an example (air code)...

' have variable to store unique identifier for record
dim lngRecordId as long

' assign unique value to variable
lngRecordID = txtRecordID

' code here to do whatever....

' use recordset clone to return to record

me.recordsetclone.findfirst "RecordID=" & lngRecordID
me.bookmark=me.recordsetclone.bookmark

Luck
Jonathan
 
G

Gianluca

Jonathan Parminter said:
Hi Gianluca,

use the following as an example (air code)...

' have variable to store unique identifier for record
dim lngRecordId as long

' assign unique value to variable
lngRecordID = txtRecordID

' code here to do whatever....

' use recordset clone to return to record

me.recordsetclone.findfirst "RecordID=" & lngRecordID
me.bookmark=me.recordsetclone.bookmark

Luck
Jonathan

Hi Jonathan
I agree with you if i need to set as first record of my form
the record i have modified, but my situation is a little different
Example:
in my continous form i have 20 records.
I scroll the form in order to have as first visible record the
number 12 (or RecordID=12; this is the information i need).
The last visible record in the form is the number 20.

Then i modify the recordID=18.
I make some operations on all 20 records.
I refresh the form
Now i need to have as first record visible in the form the n° 12.

The code you wrote me is ok to do the last positioning, but is not
ok (i think) to be able (in any moment and via code) to get the recordID
of the first visible record (in my example recordID is 12) of the form.

Can anyone help me?
Gianluca
 

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