MS Access form_current() firing multiple times

Posted by Eric G on Stack Overflow See other posts from Stack Overflow or by Eric G
Published on 2010-05-06T00:28:13Z Indexed on 2010/05/06 0:38 UTC
Read the original article Hit count: 391

Filed under:
|
|

I have a form with two subforms (on separate tab pages). It's an MDB project in Access 2003.

When it initially opens, Form_Current on the active subform fires once, as it should.

But when you move to another record (ie. from the main form), it fires Form_Current on the active subform 4 times. Then subsequent record-moves result in Form_Current firing 2 times. This is a pain, because the subforms have a lot of fields that get moved and/or hidden and so it jumps around for every Form_Current, not to mention being slow.

I am opening the form with a filter via DoCmd.OpenForm (actually it sends the filter in via OpenArgs). FilterOn is only set once, in Form_Open on the main form, never in the subforms. Form_Current is not called explicitly anywhere else in the code.

When I look at the call stack when Form_Current fires moving the first time, it looks like:

my_subform.Form_Current
[<Debug Window>]
my_subform.Form_Current

So it seems like something in Form_Current is triggering another Form_Current event. But only on the first record move.

The code in Form_Current is somewhat complex, involving custom classes and event callbacks, but generally does not touch the table data. The only thing I can think might be triggering a Form_Current is that it checks OldValue on form controls - could this be causing it?

Or anything else come to mind?

Thanks.

Eric

© Stack Overflow or respective owner

Related posts about ms-access

Related posts about ms-access-2003