Have a form with a sub form.
How come when I clock add new record on the main form the subform does not do the same, it still has the data from the previous record
Have a form with a sub form.
How come when I clock add new record on the main form the subform does not do the same, it still has the data from the previous record
The subform container on the form (not the subform itself) has master/child link properties that keep the subform in sync with the main form. The wizard would/should have asked about it, but you can set them manually.
When you add a new record on the main form the record is not updated until you save the record. Since the subform doesn't have a link to the new record it doesn't do anything.
That is not what is happening. When I add a new record on the main form the subform still has the information of the previous main form. If I update the subform for the new record it updates the record on the previous form as well.
I know it has to be something I set up incorrectly, I just cannot seem to locate the issue
If pbaldy's answer is not the solution I would be shocked. Shocked I tell you!
Seriously: he's right. Look for the 'Link Child Fields' and 'Link Master Fields' properties of the subform control on the main form. (you have to select the subform control itself, not the subform that is visible within it, and view the data tab of the properties dialog).
You should have the pk field of the main form's recordsource listed in the link master field property, and the related fk field from the subform's recordsource in the link child field property.
If these properties are blank, the linkage doesn't exist and, obviously, won't work.
If the field is missing from your subform (it can be invisible, but must be present), the linkage won't work.
Are the master/child links set?
Please check the file attached.
Okay that part is fixed. It was the link between the main and the sub form that was the issue.
Have one last issue with this form and I have no idea how to go about it.
The form is an order form. Somehow I need to have the footer of the main form give a total of all the individual totals from the sub form. The rest I can fix, but I have to idea how to do this since the subform may only have 1 line or could have an unlimited amount of lines
You put a textbox in the footer of the subform that sums the field, and then refer to that textbox on the main form.
I have 2 forms that I need to do that on. For the first It works wonderfully.
For the second, which needs to be totaled is a calculated control, it took some time but I have the total working now on the subform, but when I go to put the total on the footer of the main form it does not work