Use the BeforeUpdate event of the form to validate the record before it gets
written to the table.
Example:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Surname) Then
If MsgBox("Save with no surname?", vbYesNo+vbDefaultButton2) <>
vbYes Then
Cancel = True
End If
End If
End Sub
Setting Cancel to True prevents the save.
To destroy the entry, use:
Me.Undo
There are so many ways a record can be saved, that Form_BeforeUpdate is your
only safe event.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Brad said:
I'm using Access 2000. I have a form with textboxes, combo boxes..etc. The
user will populate the form using an Access Interface and I have a "OK"
button which I would like to be the final verification. If I just set the
control source property to a certain field, it populates the table as soon
as it loses focus. I would like to populate my fields using the click event
of the button..ex. something like Field = cboTest.Value etc...