How to save record from before_update event

Fekla

Registered User.
Local time
Yesterday, 20:53
Joined
Jan 7, 2007
Messages
22
Good day to you all.

I am trying to write code which first cancels the before_update event, and then sets focus to another control. Sadly, it gives me the 2108 error that I have to save the field first. Tried the DoCmd.Save but unsuccessfully. Any ideas?

Code:
Private Sub Field1_BeforeUpdate(Cancel As Integer)
    Cancel = True
    Me!Field1.Undo
    Field2.SetFocus
    
    
End Sub
 
Check in the table Field1, is the proeprties REQUIRED = yes ??
 
try

Private Sub Field1_BeforeUpdate(Cancel As Integer)
Cancel = vbcancel
sendkeys "{esc}"
Field2.SetFocus


End Sub
 
MStef, no, Field2 is not required, otherwise it is too obvious that it can not be left blank.
Gemma, I tried your suggestion, but it gives me the same 2108 error.
So I looked around, and looked, and looked, and googled..

And I found out that this is a general problem with Undo Command, and in order to overcome it, I have to post the same code in the Form_BeforeUpdate event.
 

Users who are viewing this thread

Back
Top Bottom