By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,087 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

Subform data not saving when focus moves to parent

P: n/a
I have a form with several subforms. Users enter the data, then on the
parent there is a command button that runs code to generate a .pdf
document from a report based on the data they are working with. If a
user enters data in a subform, then directly clicks the command button
on the parent form, the data in the subform is not included in their
document. I THOUGHT that as soon as focus left the subform, any
pending changes to the data were saved. In fact, in googling "dirty"
and "subform", the general feedback that I've seen suggests that you
don't need to test for a dirty subform, since it will never be dirty
since it's saved by the time the code for the command button is
executed. But that is clearly not what I'm experiencing.

When this does happen, all I have to do is move their cursor to another
record or into another subform, and THEN the data saves. But not when
moving directly from editing a record in a subform, to a command button
on the parent. Any ideas why the subform is not saving when I move to
the parent? If I do have to test for dirty subforms, that is fine, but
one question I have: if I test for dirty subforms, find any, then do a
save record command, does that automatically save the records in all
the subforms? I'm not aware of any way to direct WHAT is being saved.
(?)

Dec 5 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
What you wrote (the CurrentRecord in Subform is saved when the Focus is
moved from the Subform to the MainForm, e.g. Focus in the Subform and the
CommandButton on the Subform is activated) is true. However, there may be
timing issues and the update may still be in cache pending so the Report
(which gets the data from the Table) may not pick up the new (or being
edited) Records ...

A a test, try moving athe Focus from the Subform to the MainForm, wait about
5 seconds and then activate the Command Button and see if the new (or being
edited)Record (from the Subform) is picked up.

If this is the case, you may like to use the Idle method with dbRefreshCache
option before the OpenReport statement in the CommandButton_Click Event ...

--
HTH
Van T. Dinh
MVP (Access)

<go****@darincline.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
>I have a form with several subforms. Users enter the data, then on the
parent there is a command button that runs code to generate a .pdf
document from a report based on the data they are working with. If a
user enters data in a subform, then directly clicks the command button
on the parent form, the data in the subform is not included in their
document. I THOUGHT that as soon as focus left the subform, any
pending changes to the data were saved. In fact, in googling "dirty"
and "subform", the general feedback that I've seen suggests that you
don't need to test for a dirty subform, since it will never be dirty
since it's saved by the time the code for the command button is
executed. But that is clearly not what I'm experiencing.

When this does happen, all I have to do is move their cursor to another
record or into another subform, and THEN the data saves. But not when
moving directly from editing a record in a subform, to a command button
on the parent. Any ideas why the subform is not saving when I move to
the parent? If I do have to test for dirty subforms, that is fine, but
one question I have: if I test for dirty subforms, find any, then do a
save record command, does that automatically save the records in all
the subforms? I'm not aware of any way to direct WHAT is being saved.
(?)

Dec 5 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.