Synchronized forms and Form_BeforeUpdate

J

JB

I have a project with a complex series of nested forms that are
synchronized using the Where condition of DoCmd.OpenForm. I have a
standard form (not continuous records) called NetworkPrograms.
NetworkPrograms also contains a subform called StandardAirtime. The
StandardAirtime subform is not using a continuous layout. It shows only
the most recent airtime in the subform and the client can scroll
through the other records in the subform to view the past standard
airtimes. This is causing a separate problem that I will address later.


The NetworkPrograms form has a command called ShowEpisodes. That
command opens a Continuous form called ShowEpisodes which lists all of
the episodes for a given program. ShowEpisodes also automatically opens
another Main form, called Airdates, that shows the related airdates of
the currently selected episode. ShowEpisodes and Airdates appear
simultaneously in a split screen layout. Each time an Episode is
selected in the ShowEpisodes form it uses a filter in the Current Event
to refresh the Airdates form to show the airdates for the selected
episode.

That's the background, here's the problem. When I select an episode in
the ShowEpisodes form, the following events are triggered:
ShowEpisodes_FormCurrent, Airdates_BeforeUpdate, Airdates_FormCurrent,
ShowEpisodes_FormCurrent. I do not understand why the BeforeUpdate
event is being triggered on the Airdates form. I am only selecting an
episode on the ShowEpisodes form and no code is touching or modifying
the Airdates form that I can tell. If I test Me.Dirty in the Airdates
form, it says True and I do not know why. This is a huge complication
for me. My code is doing many things on the Airdates form based on the
BeforeUpdate event.

If the user has not edited the Airdates form then a different set of
actions needs to occur but right now I can not seem to address that
properly with the current problem. I would like to prevent the
BeforeUpdate event from firing in this situation and am wondering if
something I am doing in the ShowEpisodes form may be causing it.

If it can not be helped then I can accept that I can not prevent the
BeforeUpdate event from being triggered. How else can I determine if no
change has been made to the Airdates record if the BeforeUpdate event
always fires and Me.Dirty always evaluates as True?
 
M

Marshall Barton

JB said:
I have a project with a complex series of nested forms that are
synchronized using the Where condition of DoCmd.OpenForm. I have a
standard form (not continuous records) called NetworkPrograms.
NetworkPrograms also contains a subform called StandardAirtime. The
StandardAirtime subform is not using a continuous layout. It shows only
the most recent airtime in the subform and the client can scroll
through the other records in the subform to view the past standard
airtimes. This is causing a separate problem that I will address later.


The NetworkPrograms form has a command called ShowEpisodes. That
command opens a Continuous form called ShowEpisodes which lists all of
the episodes for a given program. ShowEpisodes also automatically opens
another Main form, called Airdates, that shows the related airdates of
the currently selected episode. ShowEpisodes and Airdates appear
simultaneously in a split screen layout. Each time an Episode is
selected in the ShowEpisodes form it uses a filter in the Current Event
to refresh the Airdates form to show the airdates for the selected
episode.

That's the background, here's the problem. When I select an episode in
the ShowEpisodes form, the following events are triggered:
ShowEpisodes_FormCurrent, Airdates_BeforeUpdate, Airdates_FormCurrent,
ShowEpisodes_FormCurrent. I do not understand why the BeforeUpdate
event is being triggered on the Airdates form. I am only selecting an
episode on the ShowEpisodes form and no code is touching or modifying
the Airdates form that I can tell. If I test Me.Dirty in the Airdates
form, it says True and I do not know why. This is a huge complication
for me. My code is doing many things on the Airdates form based on the
BeforeUpdate event.

If the user has not edited the Airdates form then a different set of
actions needs to occur but right now I can not seem to address that
properly with the current problem. I would like to prevent the
BeforeUpdate event from firing in this situation and am wondering if
something I am doing in the ShowEpisodes form may be causing it.

If it can not be helped then I can accept that I can not prevent the
BeforeUpdate event from being triggered. How else can I determine if no
change has been made to the Airdates record if the BeforeUpdate event
always fires and Me.Dirty always evaluates as True?


That sure is symptomatic of some code in the AirDates form
that is setting a bound control's value. I would suspect
the Current (or Load) event since you haven't done anything
else when you open the form.
 
J

JB

Sure Enough! In my efforts to fix a previous issue in a different part
of the application I created code that set a flag on the form. I hate
it when I spend a whole day on something stupid that I created myself!

Thanks for the feedback. Sometimes, I feel like my mind is frozen and I
just can't see what is happening in the code.
 
M

Marshall Barton

JB said:
Sure Enough! In my efforts to fix a previous issue in a different part
of the application I created code that set a flag on the form. I hate
it when I spend a whole day on something stupid that I created myself!

Thanks for the feedback. Sometimes, I feel like my mind is frozen and I
just can't see what is happening in the code.


If that were the qualifications for a Society of Stupids, we
all would be members in good standing ;-)
 

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