where to put my function call...

Y

Yblitzka

Greetings to all!

I have a database with a large form in it, and a number of pages inside a
tab control. Because this form is rather hefty, the original developer
decided to hide it when we click the close button, so it loads faster the
next time and it remembers which page we're on. We don't plan to change that.

The problem I'm having is that I have added a subform to one of the pages,
and for some records on the main form, the subform does not have any records
yet (new table). My subform has a function (called subformUpdate) that will
add the appropriate records if necessary, set a couple of values if
necessary, and requery.

I call this function in the tabcontrol change event and in the main form
open event, and it in the subform's open event.

The only scenario not covered now is when someone re-opens the form and that
page is already active. The form becomes visible, with the new data, and I'm
already on my page, so the form open and tabchange events don't fire. What
event can I use in the main form, tab control, page, or subform to make sure
that in this scenario, the subform's "subformupdate" is called?

I'd like to avoid "on current" events if possible - they run too often and I
don't want to bog this thing down.

Any ideas, anyone?

Thank you for your time!
 
J

Jeff Boyce

If I recall correctly, OnCurrent fires when records change ...

Have you looked into the OnActivate event?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Y

Yblitzka

I'll try the mainForm's On Activate, combined with checking if the active
page is my page with the subform. The only other related control with an On
Activate is the subform, and I don't think that will work since the subform
is not being activated.

And yes, the on current eveent fires when records change. Like when the form
is opened. And when the form is closed. And when data is requeried (which
happens at certain points in the main form after certain controls are
updated). I think putting it in there would cause more problems than solved.

Will post back with results.
 
Y

Yblitzka

Update: failed

Putting "call subformupdate" in the OnActivate event of the main form did
not work. Oddly enough, setting a msgbox to run in the OnActivate event of
the main form did run when the form is made invisible again. But, bringing it
into view does not fire the on_activate event.

Is there another event someone could suggest?

What I could really use is an "event firing" list of what fires in what
order when a form that was not visible is made visible. Honestly, you would
think MS would document these event lists a little more.
 
J

Jeff Boyce

At least in past versions of Access HELP, that "sequence of firing"
information is available...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Y

Yblitzka

My mistake. The more common sequences are available, just not the sequence
that I need. I am moving from one form to another, but the form on focus does
not fire because there is (presumably) a control that does have the focus. I
am not sure why my on_activate event was not firing for the main form.

Will be back at it tomorrow.

Thank you for your help, Jeff!
 

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