[AccessD] current record of form being reset, can't find the cause

Tom Zal tom053 at gmail.com
Tue Jan 17 07:58:09 CST 2012


Hi - I have a puzzle I can't solve. I'm working on a project that involves
a form (for layout only, no recordsource) with a datasheet subform. When
the user applies or removes a filter or sort on the subform, I want the
current record to remain the same. Access default behavior seems to be to
lose the current record. I have a function to save the value of a field of
the current record in the ApplyFilter event, and a function to then look up
that record using recordsetclone and findfirst in the next Current event
and make it the current record with .bookmark. (If you have a better method
to suggest that would be great.)

(When the bookmark restores the record, it fires the Current event again,
but a local variable there has now been set so no recursive loop happens)

This actually works fine for applying and removing sorts and removing
filters. However when applying a filter, although the current record is
restored, as I can see by single stepping through the code, after the
process finishes, something changes the record to the first record. The
Current event is fired by this change and when I look at the call stack
there, there is nothing but the OnCurrent function of the form. I think
this means that my code did not change the record?

I created a new little database with a table, query, and datasheet form,
and the same function for the same events, and everything works fine there,
the current record is restored in all cases.

Does anybody have any thoughts about what may be happening? I know there's
probably not enough info here to identify the problem, but any ideas would
be appreciated.


More information about the AccessD mailing list