How to programmatically access the "Reference" field and the "Memo" field in Small Business Accounting (920196)



The information in this article applies to:

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

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

INTRODUCTION

Some forms in Microsoft Office Small Business Accounting contain a Reference field and a Memo field. You can use the Software Development Kit (SDK) to programmatically access these fields. You can read the Reference field and the Memo field by using the SDK. You can also set the Reference field and the Memo field by using the SDK.

MORE INFORMATION

Any type that implements the IContract interface has a property that is named InternalComments. Any type that implements the IDocument interface has a property that is named ReferenceNumber.

The following code sample retrieves sales invoice 158 from the Northwind Traders database. Northwind Traders is a fictitious company that is used for demonstration in Small Business Accounting. The code then sets the ReferenceNumber to "this is the reference number." The code sets the InternalComments to "this is the internal comment."

The ReferenceNumber field corresponds to the form field that is labeled Reference. The InternalComments property corresponds to the form field that is labeled Memo.
ISmallBusinessInstance iSbi = // Initialize SBA instance

// This code sample works with the sample product company Northwind Traders.
ISalesInvoice si = (ISalesInvoice) GetDocumentByDisplay(iSbi.SalesInvoices, "158");
si.InternalComments = "this is the internal comment";
si.ReferenceNumber = "this is the reference number";

si.Save();


static IDocument GetDocumentByDisplay(IBaseMasterView view, string displayNum)
{
	IDocument document = null;
	DataRow row = null;

	if (view != null)
	{
		DataView dv = view.DataView; 

		dv.RowFilter = String.Format("DocumentDisplayNumber='{0}'", displayNum);
		// dv.Sort = "ModifiedDateTime DESC";

		if (dv.Count > 0)
		{
			row = dv[0].Row;
		}
	}

	if (row != null)
	{
		document = (IDocument) view.GetByDataRow(row);
	}

	return document;
}
After the code successfully runs, you can open the sales invoice in Small Business Accounting to verify that the values are now displayed in the Sales Invoice form.

Modification Type:MajorLast Reviewed:6/23/2006
Keywords:kbExpertiseAdvanced kbMBSMigrate kbhowto KB920196 kbAudDeveloper kbAudEndUser