Solved How to add a new record in subform on open? (1 Viewer)


Registered User.
Local time
Today, 13:29
May 1, 2018
@tihmir ,
The reason for the questions is because it makes no sense at all to add "empty" records to a table. You NEVER want to save a record that has no data except a primary key. The proper technique is to have the form opened to the "new" record. The user types the values he wants. As soon as the user types the first character, Access automatically assigns the new record ID if you are using an autonumber. Then you should have code in the FORM's BeforeUpdate event to validate the data to make sure that all required fields are supplied and no fields with specific edit rules violate the rules. For example if you are capturing DOB, the date would never be > today. If the person hasn't already be born, you cannot predict when they will be born.

If you are using the Access Switchboard, you have the option of opening a form in different modes. Add, Edit, Read Only for example

A word to the wise - NEVER EVER dirty programmatically a record that they user has not first dirtied himself.
Тhanks for the advice!

Users who are viewing this thread

Top Bottom