Share via

Subform actions

Anonymous
2020-01-24T03:16:21+00:00

Next problem.  I have a form that links to data Table for daily stats, within that I have a sub form linked to a table for tracking Hours worked or Leave taken.  I have a button on main form to Add a new record, and want to press this and have Form and Sub form data written to their respective Tables, and cleared ready for new data.  The Hiccup is that I am in an environment where we cannot use self made macros; so I need to be able to use inbuilt functions only.  Thoughts??

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2020-01-24T12:10:16+00:00

    By 'linked to' I assume you mean that the form and subform are bound to the relevant referenced and referencing tables in a one-to-many relationship.  The subform should be linked to the parent form by setting the LinkMasterFields property to the name of the parent form's table's primary key, and the LinkChildFields property to the name of the corresponding foreign key in the subform's table.

    The current record in the parent form is automatically saved when you move focus to the subform.  The subform's current record is automatically saved when you move to another record, including a new one in the parent or subform, or close the form.

    If your office policy allows you to use wizards then you can create a macro behind a button in the parent form to moved to a new record, which will automatically save any uncommitted record in the subform.

    In form design view first ensure that 'use control wizards' is selected in the Design ribbon.  Then add a button to the parent form from the toolbox,  The wizard will then kick in.  Select 'record operations' as the category and 'add new record' as the action.  Then work your way through the wizard with the Next button, being sure to give the button a meaningful name such as cmdNewRecord, rather than accepting the meaningless default name which Access gives to the control

    If your office policy is so proscriptive as to prevent you using the wizard, then you cannot use a command button, and will be forced to use the miniscule [>*] 'button' on the built in navigation bar at the bottom of the parent form.

    Was this answer helpful?

    0 comments No comments