How to delete line items and members of collections in Small Business Accounting 2006 (908351)



The information in this article applies to:

  • Microsoft Office Small Business Accounting 2006
  • Microsoft Office Small Business Management Edition 2006
  • Microsoft Office Small Business Accounting 2006 Software Development Kit 1.2

INTRODUCTION

This article describes how to delete line items and members of collections in Microsoft Office Small Business Accounting 2006.

You can delete any .NET type that implements the Microsoft.BusinessSolutions.SmallBusinessAccounting.IBaseChildEntity interface by setting the IsDelete property to true and then calling the Save() method of the root object.

MORE INFORMATION

Certain Small Business Accounting 2006 master entities contain DataView properties that represent child entities. You can delete these child entities by setting the IsDelete property to true and then calling the Save() method.

The ICustomerAccount master entity is an example. This master entity contains a collection of phone numbers in a property that is named CustomerVendorPhones (ICustomerVendorPhoneView). (The collection of phone numbers is the ICustomerVendorPhone property and the child entity.) The following sample code checks to see whether a business phone number exists. If a business phone number exists, the code deletes the number by setting the IsDelete property to true and then calling the ICustomerAccount.Save() method. In the following sample code, the "cust" reference variable represents an instantiated ICustomerAccount object.
if (cust.CustomerVendorPhones.DoesTypeExist((int) CustomerVendorPhoneType.Business))
{
	ICustomerVendorPhone iCvp = 
		cust.CustomerVendorPhones.GetByType(CustomerVendorPhoneType.Business);
	iCvp.IsDelete = true;
	cust.Save();
}

Modification Type:MinorLast Reviewed:3/31/2006
Keywords:kbMBSMigrate kbhowto KB908351 kbAudEndUser kbAudKnowledgeWorker