Data Validations

Data Validations

Data validations are used to determine whether the data that has been entered into a free form text field is meets user definable rules. Validation functions should be written to receive two input parameters. The first is the data that the user has entered into the field. The second is the ID of the relevant object (e.g. AssetID, ActionID, RequestID etc.)

Data validations should return a logical value (i.e. true or false)

The following example shows how a simple validation can be created to ensure that the entry in one of the free form text fields contains the abbreviation of a television station.

Public Function ValidateStation(rData, ID As Long) As Boolean

 

 If Not (rData = "ABC" Or rData = "SBS" ) Then

  MsgBox"Invalid television station"

  Exit Function

 End If

 

 ValidateStation = True

 

End Function

Note that in this example that the ID is not used.

If a Data Validation fails, a notification dialog is displayed and the user is returned to the field that is being validated.