Before_Update event ( sub-form ) ? (1 Viewer)

liamfitz

Registered User.
Local time
Today, 01:21
Joined
May 17, 2012
Messages
240
I have a Cancel = True which triggers correctly, on a condition in the Before_Update event of a data field/control on a sub-form. However, the data which would have changed ( but won't now ) remains in the text box/control, and Focus stays on it. Only by closing and re-opening the form, can you 'refresh' the unchanged data ?? Any suggestions.:confused:
 

Beetle

Duly Registered Boozer
Local time
Yesterday, 18:21
Joined
Apr 30, 2011
Messages
1,808
Use the Undo method. Example;

Code:
Private Sub YourControl_BeforeUpdate (Cancel As Integer)

'some condition is not met
Cancel = True
Me.YourControl.Undo

End Sub
 

liamfitz

Registered User.
Local time
Today, 01:21
Joined
May 17, 2012
Messages
240
That works perfectly Beetle. Thank you very much.
 

Users who are viewing this thread

Top Bottom