Maintaining record pointer position in continuous form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a continuous form that you can click on a record to requery the form
with different records. In this way you can 'drill down' through a structure
of records.
My problem is that when I come back up the structure (via a command button)
I need to retain the position i.e. where the record pointer was when I
drilled down. I know how to do this via a hidden field on the form but this
allows saving only one pointer. What I need is a 'stack' of pointers that I
'push' positions on to and the 'pull' them off as I go back up.
How do do this? Any ideas will be most appreciated.
 
mscertified said:
I have a continuous form that you can click on a record to requery the form
with different records. In this way you can 'drill down' through a structure
of records.
My problem is that when I come back up the structure (via a command button)
I need to retain the position i.e. where the record pointer was when I
drilled down. I know how to do this via a hidden field on the form but this
allows saving only one pointer. What I need is a 'stack' of pointers that I
'push' positions on to and the 'pull' them off as I go back up.


Why not just use a module level array?

Dim RecID(100) As Variant, StkPtr As Integer
. . .
Push:
RecID(StkPtr) = Me.pkfield
StkPtr = StkPtr + 1
'drill down
. . .

Pop:
. . .
With Me.RecordsetClone
StkPtr = StkPtr - 1
.FindFirst "pkfield = " & StkPtr
If Not .NoMatch Then Me.Bookmark = .Bookmark
End With
 
Back
Top