From: Lloyd on 1 May 2010 11:01 I am doing some data verification in my subform, but users are able to get around this by just selecting the X and closing the form while in the field. Is there a way in the fields on exit event, that when the code runs telling the user they must enter the required data that it also stops the form from unloading? Otherwise I assume my only option is to put the same code in the forms unload event, is that correct? sample code below: Private Sub Method_Exit(Cancel As Integer) If Me.PersonCaseType Like "Mur*" And Me.PersonType = "Victim" Then If IsNull(Me.Method) Then MsgBox "You must enter a Method of Attack for this person", vbCritical, "Enter a Method of Attack" Cancel = True End If end sub
From: Linq Adams via AccessMonster.com on 1 May 2010 11:10 Checking for null fields cannot be done reliably in any event of the control itself. This kind of validation needs to be done in the Form_BeforeUpdate event. It will then be executed whether moving to another record or closing the foem. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201005/1
|
Pages: 1 Prev: Populating a field automatically Next: Use calculate age to write other fields automatically |