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

Possible to cancel the subform update and moving away from the subfrm? 1

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i have a subform which has to save the introduced data only if both fields of the subform are completed. I have tried:


If field1Completed = False or field2Completed = False Then
DoCmd.CancelEvent
End If


but that prevents the focus moving away to the master form.

I have tried instead, in the Form_AfterUpdate event:


If field1Completed = False or field2Completed = False Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If


but it gives the error '3179' in running time: "The data base motor stopped the proccess because another user is trying to modify the same data than you at the same time".


Any way of making possible that the subform discards introduced data if any of the two fields isn't completed, and focus move away?

Thanks for any help given.
 
On lost focus...

Save the record, run a delete query to get rid of the problem data and requery the subform.
 
Thanks lameid.

On lost focus, you mean the subform or the subform control?
 
I would say the lost focus event of the control...


Docmd.runcommand acCmdSaverecord 'I guessed at the constant
'Delete query here
Me.Requery
 
How are ya Bresart . . .

Have you tried [blue]Me.Undo[/blue] instead?

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Thanks TheAceMan1. It matchs with what i was searching.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top