When a form is opened and the object recordset contains no records, a new record instance is created. It becomes real as soon as a field is initialized either thru a default value defined in the table or direct setting.
As a result blank records can be left in a table in the event of Exitting without some form of cleanup.
Using the AllowAdditions propoerty does not help as this causes an error once the insertion is tried.
The Form_AfterInsert event appears to be called ok but it sets the Dirty bit to False. As a result I have to set a NewRecordInserted boolean to True and then set the Dirty property at the end of Form_Load event to True if the NewRecordInserted flag was set.
I am a little concerned about this method because the NewRecordInserted flag might not, depending upon speed and timing, be set at the time of exit.
Has anyone else come across this problem and perhaps has some elegant solution
As a result blank records can be left in a table in the event of Exitting without some form of cleanup.
Using the AllowAdditions propoerty does not help as this causes an error once the insertion is tried.
The Form_AfterInsert event appears to be called ok but it sets the Dirty bit to False. As a result I have to set a NewRecordInserted boolean to True and then set the Dirty property at the end of Form_Load event to True if the NewRecordInserted flag was set.
I am a little concerned about this method because the NewRecordInserted flag might not, depending upon speed and timing, be set at the time of exit.
Has anyone else come across this problem and perhaps has some elegant solution