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 / November 2005

Tip: Looking for answers? Try searching our database.

Adding a record to a subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Widemonk - 24 Nov 2005 16:01 GMT
This has been bugging me for ages and it's probably right in front of me.

Form Header:
A series of unbound controls, some of which source info from tblPersonInfo

Form Detail:
A subform that displays records of tblHolidays

I initially tried a query that links all the info from both tblPerson and
tblHolidays but upon creating a new 'holiday' record, it also created a new
'person' record instead of just refering to it.

Basically, when you click cmdAdd, i want to go to the sub form, create a new
record then transfer the info from the unbound header controls into the
various fields of the new record.

I should really know this but its driving me nuts.

Thanks for any help you might be able to give.
Graham Mandeno - 24 Nov 2005 21:27 GMT
Do you have a one-to-many relationship between tblPerson and tblHolidays?
And do you have a control (perhaps a combo box) on the main form that
contains the primary key for the current person?

If so, what you need to do is set the LinkMasterFields and LinkChildFields
properties of your subform control as follows:
   LinkMasterFields:  name of the "PersonID" control on your main form
   LinkChildFields:  name of the related foreign key field containing the
"PersonID" in tblHolidays

This will ensure that any new record added to your subform will have the
correct PersonID, which will automatically link it to the correct tblPerson
record.
Signature

Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

> This has been bugging me for ages and it's probably right in front of me.
>
[quoted text clipped - 17 lines]
>
> Thanks for any help you might be able to give.
 
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.