This example illustrates simple data validation. In the Authors table in the Biblio.mdb database, there are two fields: Au_ID and Author. Since the value in Au_ID is used to uniquely identify the author, this value should not change. The example doesn't allow changes to the Au_ID field, which is bound to Text1
.
Private Sub Data1_Validate (Action As Integer, Save As Integer)
If Text1.DataChanged Then ' Check for change in data.
MsgBox "You can't change the ID number."
Text1.DataChanged = False ' Don't save changed data.
End If
...
End Sub