Sequence of events between form and subform

G

Guest

Does anyone have a lead on a definitive reference for the sequence of events
in moving from a form to a subform and back to the main form?

Specifically, I have multiple subforms for entering a variety of data. My
main form has a subform control whose recordsource is set depending upon a
main form selection. When the entry is completed, I want to return to the
main form and display my datasheet subform with all the entries for the main
record. I can't determine what events are triggered when I return the focus
to the main form. thx
 
G

Guest

I was hoping for something more proactive so, upon initially entering the
form, as well as returning from the subform, any existing detail records
would be displayed.

Does a resource exist that clearly explains the sequence of events?
"Building Applications with Microsoft Access" graphically explains opening
and closing a form, entering and exiting a control, switching between
controls on different forms, updating data in a control, entering data in a
new record, and deleting records. Subforms seem to be a different sort of
beast.

Sandra Daigle said:
Have you tried the exit event for the subform control?

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Does anyone have a lead on a definitive reference for the sequence of
events in moving from a form to a subform and back to the main form?

Specifically, I have multiple subforms for entering a variety of
data. My main form has a subform control whose recordsource is set
depending upon a main form selection. When the entry is completed, I
want to return to the main form and display my datasheet subform with
all the entries for the main record. I can't determine what events
are triggered when I return the focus to the main form. thx
 
S

Sandra Daigle

Here is an online article - this looks like something that used to be in the
online help:

Order of events for database objects
http://office.microsoft.com/en-us/assistance/HP051867611033.aspx

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

I was hoping for something more proactive so, upon initially entering
the form, as well as returning from the subform, any existing detail
records would be displayed.

Does a resource exist that clearly explains the sequence of events?
"Building Applications with Microsoft Access" graphically explains
opening and closing a form, entering and exiting a control, switching
between controls on different forms, updating data in a control,
entering data in a new record, and deleting records. Subforms seem
to be a different sort of beast.

Sandra Daigle said:
Have you tried the exit event for the subform control?

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

Does anyone have a lead on a definitive reference for the sequence
of events in moving from a form to a subform and back to the main
form?

Specifically, I have multiple subforms for entering a variety of
data. My main form has a subform control whose recordsource is set
depending upon a main form selection. When the entry is completed,
I want to return to the main form and display my datasheet subform
with all the entries for the main record. I can't determine what
events are triggered when I return the focus to the main form. thx
 
G

Guest

I found that article, too. The expandable section "Order of events for forms
and subforms" is one sentence: "Events occur for forms when you open or
close a form, move between forms, or work with data on a form."

Does that imply that the events that occur in moving between two forms --
LostFocus (control on form1), Deactivate (form1), Activate (form2),
and GotFocus (control on form2)
-- also occur between a form and a subform --
LostFocus (control on subform), Deactivate (subform), Activate (main
form), and GotFocus (control on main form)?

The primary difference between linear programming (COBOL, etc.) and
event-driven programming (VBA) is events. I wish a strong reference on
events existed!

Sandra Daigle said:
Here is an online article - this looks like something that used to be in the
online help:

Order of events for database objects
http://office.microsoft.com/en-us/assistance/HP051867611033.aspx

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.

I was hoping for something more proactive so, upon initially entering
the form, as well as returning from the subform, any existing detail
records would be displayed.

Does a resource exist that clearly explains the sequence of events?
"Building Applications with Microsoft Access" graphically explains
opening and closing a form, entering and exiting a control, switching
between controls on different forms, updating data in a control,
entering data in a new record, and deleting records. Subforms seem
to be a different sort of beast.

Sandra Daigle said:
Have you tried the exit event for the subform control?

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.


HartJF wrote:
Does anyone have a lead on a definitive reference for the sequence
of events in moving from a form to a subform and back to the main
form?

Specifically, I have multiple subforms for entering a variety of
data. My main form has a subform control whose recordsource is set
depending upon a main form selection. When the entry is completed,
I want to return to the main form and display my datasheet subform
with all the entries for the main record. I can't determine what
events are triggered when I return the focus to the main form. thx
 
J

John Goodfellow

When working with an Access form/subform recently, I found it very
illuminating to include an event handler sub for every form level event in
both the main and sub form modules. Each handler just wrote a line to the
debug window saying it had fired. I was able to trace the event sequence
from that. What I found was not exactly intuitive. Don't use a MsgBox,
that causes extra events to fire.
John G.
 

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