Examples: DUOSObjectExtractID method

The following example uses a button on a VBA user form to loop through a collection named Vendors. It uses the DUOSObjectExtractID method to check whether each data object’s objectID is combined. Any object with a combined objectID uses an ID composed of the vendor’s ID and the vendor type. If the vendor type (ventype) is “PREFERRED,” the procedure updates the properties for the data object:

Private Sub CommandButton1_Click()
	Dim VendorCollection As DUOSObjects
	Dim VendorObject As DUOSObject
	Dim ObjectID As String
	Dim venID As String
	Dim ventype As String

	'Return a vendors collection
	Set VendorCollection = DUOSObjectsGet("Vendors")

	For Each VendorObject In VendorCollection
		If DUOSObjectExtractID(VendorObject.ID, venID, ventype) _
		= True Then
			'This is a combined ID. Update with new discount info.
			If ventype = "PREFERRED" Then
				'Update the properties for this vendor
				VendorObject.Properties("Discount Quantity") = "200"
				VendorObject.Properties("Discount Percent") = "6.50"
			End If
		End If
End Sub

Documentation Feedback