How to obtain custom field information in Small Business Accounting 2006 by using Visual Basic .NET (910011)



The information in this article applies to:

  • Microsoft Office Small Business Accounting 2006
  • Microsoft Office Small Business Management Edition 2006

INTRODUCTION

This article discusses how to obtain custom field information programmatically in Microsoft Office Small Business Accounting 2006 by using code that is written in Visual Basic .NET.

MORE INFORMATION

Entities such as ICustomerAccount and IVendorAccount have a user field attribute that enables end users to hold custom information about the entities.

To find the user field in Small Business Accounting, follow these steps:
  1. Click Vendors, click Vendors in the Find pane, and then click to select a vendor.
  2. Click the Custom Fields tab, and then click Customize.
  3. In the Customize Form - Vendor dialog box, click a field type, and then specify a field name.
  4. Click OK.
After a user field has been added for a specific vendor entity, you can use the following Visual Basic .NET example code to obtain the information programmatically:
// SBI is a variable that references the SmallBusinessInstance class.
// IUserFields is the interface that holds user-defined custom fields.

Public SBI as New SmallBusinessInstance   

	SBI.Logon ("Sampleproductcompany", "SERVERNAME\MICROSOFTSMLBIZ") 
	MessageBox.Show("Welcome to Small Business Accounting", "SBA Add-In")
		
		Catch ex as Exception
			If TypeOF ex Is System.Exception Then 
				SBI.LogOff()
					MessageBox("Small Business Accounting is shutting down", "SBA Add-In")

			End IF

	Dim MyVendor As VendorAccount
	Dim MyStringValue As String

   		MyVendor = SBI.VendorAccounts.GetByPrimaryKey(366)  
   		MyStringValue = MyVendor.UserFields.String1.ToString

			MessageBox.Show(MyStringValue)

Modification Type:MinorLast Reviewed:1/10/2006
Keywords:kbMBSMigrate kbhowto KB910011 kbAudEndUser kbAudKnowledgeWorker kbAudITPRO