Examples: Exists property

In the following example, the Changed event procedure runs for the Total field when the user changes an invoice amount in the Invoice Entry window. The procedure uses the Exists property to ascertain whether a corresponding invoice object already exists in the collection. If it does exist, the procedure updates it with the current system date using the VBA Date() function:

Private Sub Total_Changed()
	Dim InvoiceCollection As DUOSObjects
	Dim InvoiceObject As DUOSObject

	Set InvoiceCollection = DUOSObjectsGet("Invoices")
	If InvoiceCollection.Exists(DocumentNumber) Then
		'A data object for this invoice exists
		'Set a property to indicate the user changed the total 
		InvoiceObject.Properties("Invoice Adjustment Date") = Date
	End If
End Sub

Documentation Feedback