Microsoft KB Archive/920196

= How to programmatically access the &quot;Reference&quot; field and the &quot;Memo&quot; field in Small Business Accounting =

Article ID: 920196

Article Last Modified on 2/6/2007

-

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 &quot;this is the reference number.&quot; 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, &quot;158&quot;); si.InternalComments = &quot;this is the internal comment&quot;; si.ReferenceNumber = &quot;this is the reference number&quot;;

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(&quot;DocumentDisplayNumber='{0}'&quot;, displayNum); // dv.Sort = &quot;ModifiedDateTime DESC&quot;;

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.

Additional query words: SBA

Keywords: kbexpertiseadvanced kbmbsmigrate kbhowto KB920196

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.