Main form add new record / SubForm missing Parent ID

ym2004

Midnite Oil
Local time
Today, 13:14
Joined
Sep 23, 2004
Messages
9
Hi,

My main form has a combo box cboDate populated with [SELECT DateComplete FROM Complete] and its recordsource = [Complete] table.

The subform has a combox NAME and 3 other textboxes for numbers entry and its recordsource = [Complete Details] table.

Main and Subform have Link Child/Parent set using [Complete ID] - autoNumber from the [Complete] table.

The user will select a date from cboDate, I have filters in place that will get its associated details and display it in the subform. The user can then edit and add records in the subform. This is working for me.

This is the problem I have now -> If the user enters a new date in the cboDate, I have to then create a new Parent record and its child data. I have a function that checks the cboDate is new and then do a AddNew for the parent. The subform is not seeing the ParentID.

I have spent yesterday and today on this :mad: and getting nowhere ! Any idea how I can get this ID to appear in the subform ???
 
ym,

The normal practice when you want data from a parent form (that's not
included in the Master-Child relationship) is to set the field's Default Value
to: Forms![YourMainForm]![TheField]

But, if it is data that's in the Main Table (form), why duplicate it?

But I may not understand exactly what you're trying to do.

Wayne
 
Hi Wayne,

The main form has a combo box containing available [Date Completed] - user selects a date and it will display the details in the subform. The subform has continuous row display :combo box [Name of Staff], 3 other textboxes for number entries. The user can then edit and add to the subform.

If the user did not select a [Date Completed] but enter a 'DATE'. My code will assume this is a new entry to the main table - I have to create a new record in the parent table and then user can add records to the subform.

This ADD thing is causing me much headaches - i do not know how to get the Main form to add a new record and then the subform is available for the users to add the details.

Hope you can throw in some suggestions or work around...
 

Users who are viewing this thread

Back
Top Bottom