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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Saved Status of Record (input form)

Status
Not open for further replies.

LarryDeLaruelle

Technical User
May 19, 2000
1,055
US
The main form contains two sub forms on a tab control. When the cursor moves to one of the subforms, the record is committed.

I have an undo button on the form that tests the dirty property of the form: if true, the undo action is run, if false, the delete action is run. The undo button is not enabled until some information is entered into the First Name field. Here is the code:

If Dirty Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Else
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True
End If

This works fine if the user clicks undo immediately after adding data to a subform without making any other changes to the main form.

My problem is when data are added to the subforms and then the user updates another value on the main form. The dirty property is then true and only the undo action is triggered; the main record and any subform records are still there.

Is there a way to test whether the record has been saved and then run the delete action? I've considered capturing the record id and using a dlookup prior to running the undo/delete code but, I guess, I am looking for something more elegant.

Thanks.

Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top