Kofax DOKuStar Validation User Manual

Page 35

Advertising
background image

DOKuStar Validation Programming Manual

Page

31

Here is the source code for the example:

Dim WithEvents Amount As FieldType

Private Sub Application_OnProjectLoaded(ByVal App As Application)
Set Amount = App.Project.DataSet.Schema.DocumentTypes("Invoice").FieldTypes("Amount")
End Sub

Private Function Amount_OnFieldChanging(ByVal Field As Field, ByVal SubField as Field, ByVal
VerifyEventArgs As VerifyEventArgs) As Boolean
Amount_OnFieldChanging = True 'Preset return value
If Val(Field.Value) > 1000 Then
If MsgBox("You entered a value > 1000. Please Confirm.", vbOKCancel) = vbCancel Then
Amount_OnFieldChanging = False 'User clicked cancel, so stay in the field
End If
End If
End Function

Let us go through this line by line:

Dim WithEvents Amount As FieldType

You define a variable

Amount

that shall be used in the VBA code. This variable has the type

FieldType

, which

is a notion from the

Schema

part of the

DataSet

. This variable shall get events (

WithEvents

), one of these

events is used below.

Advertising