Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

Saving subform on Main form at the time of record save

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pete Moore - 30 Dec 2005 20:54 GMT
I have a subform on my main form.  The main form header is tblHeader and the
subform is in the detail area using tblMain.  After update of the combo box
on my main form, the subform changes based on the value in the combo box.
This works just fine, but when I save the record, the main form fields are
only being saved NOT the subform fields.

How do I save the subform fields when I save the record??

Oh, I'm using a query to link the tblHeader and the tblMain for the subform
fields which should save records from both the tables.

Thanks,
Pete
Allen Browne - 31 Dec 2005 03:28 GMT
The related record(s) in the subform cannot exist before or at the time the
record in the main form is saved.

Open the Relationshps window (Tools menu.) If you have set this up
correctly, you will have created a one-to-many relationship between
tblHeader and tblMain. tblHeader (the main form's table) will be the primary
table in the relationship. tblMain (the subform's table) will be the related
table, so it will have a field that relates to the primary key of
tblHeeader. This relationship will have the Referential Integrity box
checked.

If that is all set up correctly, then you must enter the main form record
*before* you can create the subform records. There can be no related records
in the subform until there is a record in the main form to relate them to.
To prevent accidental records in the related table, I suggest you open
tblMain in design view, select the foreign key field, and set its Required
property (lower pane in table design) to Yes.

I'm concerned about the combo box on the main form. If you are tying the
related record to the main form record on a combo, then the primary field is
probably not unique, which sounds like part of the problem.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have a subform on my main form.  The main form header is tblHeader and
>the
[quoted text clipped - 12 lines]
> Thanks,
> Pete
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.