Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic record insert

Status
Not open for further replies.

ANDYM

Programmer
Jul 6, 2000
15
0
0
GB
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
 
I have since found that the CuurentRecord becomes available in the On_Current event. I still have concerns as to why in some instances currentrecord is set to 1 when no record is selected with the form.

Loading a form with an empty dataset seems to have a setting of 0.

More info later
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top