Public Sub getShortDesc()

   Dim oConstit As CRecord

   Set oConstit = New CRecord

   oConstit.Init REApplication.SessionContext

   'load a record

   oConstit.Load 280


   'print the state

   Debug.Print oConstit.PreferredAddress.Fields(CONSTIT_ADDRESS_fld_STATE)


   'need to determine user preference for country to always print short description

   Dim REServices As REServices

   Set REServices = New REServices


   REServices.Init REApplication.SessionContext

   'determine user preference for short or long desc for code tables

   If REServices.GetUserPref(USER_fld_CODETABLE_LONG_DESC) = -1 Then


       Dim oEntries As CTableEntries

       Set oEntries = New CTableEntries


       oEntries.Init REApplication.SessionContext, tbnumCountry


       Dim sCountry As String

       sCountry = oConstit.PreferredAddress.Fields(CONSTIT_ADDRESS_fld_COUNTRY)


       Dim oEntry As CTableEntry


       For Each oEntry In oEntries

           If sCountry = oEntry.Fields(tableentry_fld_LONGDESCRIPTION) Then

               Debug.Print oEntry.Fields(tableentry_fld_SHORTDESCRIPTION)

           End If


       Next oEntry



       Set oEntries = Nothing



       Set REServices = Nothing


       Debug.Print oConstit.PreferredAddress.Fields(CONSTIT_ADDRESS_fld_COUNTRY)

   End If

   'clean up the constituent


   Set oConstit = Nothing

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.