Auto Populate a Date Field in a SubForm when creating a new record

In this frmTasks2_Team form, I have five data sources. I select a team and a billing status in the first two data sources and from there I will create a task. Once I create a task I can make a note in the next data source or schedule something in the last data source. The data sources are labeled in the images provided as is the form navigator. I am able to auto populate the 3rd data sources ‘Date’ control when making a new record by making a macro shown in one of the images and putting it in Form Properties under ‘After Record Change’. However, when I try using this macro on the Note or Schedule data sources, I get an error. Can anyone help figure out this error?

Task2-sample.odb (30.9 KB)

Error says: You are trying to insert a value in a data row, which doesn’t exist yet. Try it with
IF oForm.isAfterLast OR oForm.isBeforeFirst THEN oForm.MoveToInsertRow

Haven’t tested …

IMHO, you don’t need any macro code for this task.

defaults2.odb (40.4 KB)
Form1 stores the values to be inherited (“Category” and “Date”) in a dedicated record of a filter table.
Form2 inherits the values from the selected record of the parent form.
In both cases you pre-set default values in a parent form and enter a new number (blue “Value”) into the new record of the subform. The subform is set to “Add data only”. A form with this property set loads directly into the new record. In both cases the inherited values can be overwritten.