Refresh Subform in ADP

G

Guest

Access 2K3 ADP with SQL Server 2000

When refreshing a subform, the re-direct to original record focus is limited
to small recordsets. The original record can be found in the RecordSetClone
and the Bookmark recovered. However, if the record set is too large, the
"Me.Bookmark = rs.Bookmark" code does not work if the target record is too
far down the list. In a main form, I can use "DoCmd.GotoRecord" to send
focus to the end of the recordset and then the set bookmark code functions
correctly. However, in a subform, the form name cannot be passed to the
DoCmd.GotoRecord as an argument, since the subform doesn't appear in the
Forms collection - that line of code errors.

I suspect it is due to the fact that Access retrieves the first batch of
records and then continues fetching keys only until required to move through
the recordset - the records haven't been physically "fetched" at the point I
need to redirect the focus, so the set Bookmark command doesn't function. It
doesn't error either, so I can't tell that the code has failed and then loop
until it doesn't fail. Anyone know a work around for this problem?

Keithr
 
G

Guest

Found it - for all those interested

Me.Refresh
Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst
rs.Find "[Company Id] = " & IdNow
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

The Movefirst and Movelast force the recordset to recover all records.
Beware with very large record sets (10000+ records) as it will slow down the
response, but it does get around the limitations imposed on record sets of a
few hundred.
 

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