[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Saving records on a subform from a parent

Posted on 2009-07-16
12
Medium Priority
?
394 Views
Last Modified: 2013-11-27
I have a parent form (frmParent) that has a subform embedded in it (frmSub).  I would like to create a Save command on the parent that will save the records on the sub as if it was actually on the subform.  I am having a problem with the context.  I am using Forms!frmParent!frmSub.DoCmd.Save but get an error.  Is there something more to this?  ~ Thanks
0
Comment
Question by:marku24
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +1
12 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24868969
Hi marku24,

As soon as you go from the subform to the main form the records are automatically saved.

Gary
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24869151
DoCmd.Save acForm, "frmSub"
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24870140
tn,

Doesn't that just save the Object?
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:marku24
ID: 24870363
That didn't work.  It's telling me the object isn't open so I used the full location of "Forms!frmParent!frmSub" but it still says it's not open when I am sure it is open.  
0
 
LVL 39

Accepted Solution

by:
thenelson earned 2000 total points
ID: 24871888
Try:
Me.frmSub.Form.Dirty = False
0
 

Author Comment

by:marku24
ID: 24872046
Thanks - Doesn't that just mark the form as "not dirty".  Does it also save the form?
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24872248
It forces the save - otherwise the form would still be "dirty".
0
 

Author Comment

by:marku24
ID: 24872257
Interesting.  It seemed to have work.  Thanks
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24872393
Let's go back to the beginning...

As tbsgadi stated, the records in the subform get saved when you navigate to another record, close the form or the form loses the Focus.
So first can you tell us why you want to save the record manually, when they are saved automatically by default?

<Me.frmSub.Form.Dirty = False>
As thenelson posted, this does save the *record*.
Then you asked:
<Does it also save the form?>
Now you want to save the *Form* itself *AND* the *record*?

Saving the Form itself and saving the records are two different things.
Furthermore just doing data entry in a form/subform, does not change the form itself (does not change the forms Design), Thus, saving the form is not even applicable here.
So, again, I do not understand exactly what you are asking for?

For the record, can you clearly state What your ultuimate goal here is, and Why?

Thanks

JeffCoachman
0
 

Author Comment

by:marku24
ID: 24872553
From a parent I have data being entered on a subform based on certain options being selected from the parent.  When the data would write into the subform it would remain in "edit" mode and show the pencil on the left have side of the record.  If I click on a SAVE button within the subform the record would be committed and saved.  I don't want to manually click on that button.  I want to trigger the save and commit the record from the parent.  If I try and scroll through the parent records while the sub is still in edit mode, the parent and sub become out of sync.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24873004
OK,

If you have a solution that works now, then roll with it.
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24873249
You're welcome.  Glad to help and thank you very much for the points with "A" grade!

Happy Computing!

Nelson
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question