Examples: Changed event

In the following example, the Changed event procedure runs for the Document Date field. As the user browses records in the Receivables Transaction Entry window, the accounting system sets window field values for each record browsed. This procedure checks the value of the Document Date field, and displays a message if the document is older than 90 days:

Private Sub DocumentDate_Changed()
	Dim DaysOld As Integer
	If CDate(DocumentDate) < Date - 90 Then
		'The document is at least 90 days old
		DaysOld = Date - CDate(DocumentDate)
		MsgBox "This document is " + Str(DaysOld) + " days old." + _
		"Please post."
	End If
End Sub

Documentation Feedback