Find the first VISIBLE record

vagelisr

Registered User.
Local time
Today, 22:14
Joined
Apr 28, 2011
Messages
87
Hi to all

I have a continues test form.
The form is able to show 20 records
My table has 52 records.
Now let's say the form show from record 22 to record 41.

The user open a subform at record 31 for example

I want when the subform close and after the requery the first form show again the records 22 to record 41.

Thanks and regards.
 
You would need to store the current record (bookmark) in a constant, then go to that record when the form is reopened. You would also need to handle what record it opens on when first used.

You haven't posted any code up so we have no idea what your current process is, and whether the sub form is open or closed, or what forces the requery.
 
I upload a test database with only one form with a button and in the top a fdr(first display record) field

I want when the user press the buttol the fdr fill with the first display record.

Thanks and regards.
 
The general syntax for Minty's suggestion, to Requery a Record Source and then return to the Current Record, where [UniqueID] is a Field unique to only one Record:

Where [UniqueID] is Text

Code:
 Private Sub SaveRequeryReturn_Click()

Dim UF_Rec As String
   
   UF_Rec = Me!UniqueID
   Me.Requery
   Me.Recordset.FindFirst "[UniqueID] = '" & UF_Rec & "'"

End Sub
Where [UniqueID] is Numeric

Code:
 Private Sub SaveRequeryReturn_Click()

Dim UF_Rec As Integer
   
   UF_Rec = Me!UniqueID
   Me.Requery
   Me.Recordset.FindFirst "[UniqueID] = " & UF_Rec

End Sub

Linq ;0)>
 
A DAO.Recordset also has a PercentPosition property you can use in this case...
Code:
dim pos as single

pos = Me.Recordset.PercentPosition
Me.Requery
Me.Recordset.PercentPosition = pos
This is handy if you've deleted a record and you do a requery, since the ID of the previous record doesn't exist anymore.
 

Users who are viewing this thread

Back
Top Bottom