Populate subform/table with multiple records

mbertuol

Registered User.
Local time
Today, 17:57
Joined
Apr 3, 2004
Messages
26
I have the following tables:
tblProjects
ProjectsID (Primary key - exclusive)
ClientProjects​
tblProjectsDetails
ProjectsDetailsID (Primary key)
ClientProjectsDetails (Secondary key)​
tblQuotes
QuotesID (Primary key - exclusive)
ClientQuotes
Service
Rate​
tblQuotesDetails
QuotesDetailsID (Primary key)
ClientQuotes (Secondary key)
Service
Rate​

I have the following forms:
fmProjects
fmProjectsDetails (parent/child)​
fmQuote
fmQuotesDetails (parent/child)​


When I add a project I need to have data from the tblQuotes and tblQuotesDetails to populate tblProjects and tblProjectsDetails respectively.

It is very easy to populate tblProjects from tblQuotes since it is a single record. Therefore I use:
Me.ClientProjects = Me.ClientQuotes

:confused:
The question is: how to match the data of the 2 subforms? Since there will be more than one record per subform?

Any help is really appreciated.
 
You do it the same way you do it in the main form, one record at a time. You didn't say what event you used in the mainform so I don't know what event to recommend in the subform. As you add each project details row, you must be selecting something that identifies the row in the quote details table. Use the AfterUpdate event of that field.
 
Pat,

Thank you for taking your time.

The procedure I use to copy data from the Quote table/form to the Projects table/form is a button with a "OnClick" event. Since not all the projects have quotes, when the user comes up with a new project that has an associated quote he/she fills in the QuoteID field and press the button to have the date from the quote loaded into the projects form.

You mention I can do it the same way I do in the main form with the subform. I understand that there should be some coding where "n" matching records tblQuoteDetails to have to be replicated/copied into the tblProjectsDetails.

Is there any example of VBA to accomplish this? Or a sample database you know?

Thanks a lot.
 

Users who are viewing this thread

Back
Top Bottom