UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> People Names    

This class manages normalized people names. The class has read-write properties for

  • LastName
  • FirstName
  • MiddleName
  • Salutation
  • Title

and read-only properties for

  • FullNameSortOrder
  • FullNameNaturalOrder

Methods are

  • MakeSortOrderName
  • MakeNaturalOrderName

After assigning the read-write properties use the two methods to create the read-only properties.

The class can be used as is to manage normalized names and provide a name string in either 'natural' format (Mr. John Q. Smith) or 'sort order' format (Smith, John Q.). The class could also be expanded to include address properties or used as an object property of an address class.

CODE

'---------------------------------------------------------------------------------------
' Module    : clsPplName
' DateTime  : 24/05/2012 07:45
' Author    : Glenn Lloyd
' Purpose   : manage normalized people's name
'---------------------------------------------------------------------------------------
Option Compare Database
Option Explicit

Private Const cstrModule    As String = "clsPplName"

Private mstrLastName        As String     'person's last name
Private mstrFirstName       As String     'person's first name
Private mstrMiddleName      As String     'person's middle name or initial
Private mstrSalutation      As String     'prefix for formal address (Mr. Mrs. Ms. Dr.)
Private mstrTitle           As String     'suffix (MD, PhD, BA, etc.)
Private mstrFullNameNatural As String     'natural order name - first middle last
Private mstrFullNameSortBy  As String     'sort order name last, first middle

Public Sub MakeSortOrderName()
' Procedure: MakeSortOrderName
' DateTime: 24/05/2012 11:41:35 AM
' Author: Glenn Lloyd
' Description: build a string in Last, First Middle order
'--
   
   Const cstrProcedure = "MakeSortOrderName"
   On Error GoTo HandleError
   
   mstrFullNameSortBy = mstrLastName & ", " & mstrFirstName & " " & mstrMiddleName
   
HandleExit:
   
   Exit Sub

HandleError:
   ErrorHandle Err, Erl(), cstrModule & "." & cstrProcedure
   Resume HandleExit
End Sub

Public Sub MakeNaturalName()
' Procedure: MakeNaturalName
' DateTime: 24/05/2012 11:40:39 AM
' Author: Glenn Lloyd
' Description: build a string in 'natural' name order
'--
   
   Const cstrProcedure = "MakeNaturalName"
   On Error GoTo HandleError
   
   mstrFullNameNatural = mstrSalutation & " " & mstrFirstName & " " & mstrMiddleName & " " & mstrLastName & " " & mstrTitle
HandleExit:
   
   Exit Sub

HandleError:
   ErrorHandle Err, Erl(), cstrModule & "." & cstrProcedure
   Resume HandleExit
End Sub

Public Property Get FullNameSortBy() As String
   On Error GoTo HandleExit
   
   FullNameSortBy = mstrFullNameSortBy
HandleExit:
End Property

Public Property Get FullNameNatural() As String
   On Error GoTo HandleExit
   
   FullNameNatural = mstrFullNameNatural
HandleExit:
End Property

Public Property Get LastName() As String
   On Error GoTo HandleExit
   
   LastName = mstrLastName
HandleExit:
End Property
Public Property Let LastName(rData As String)
   On Error GoTo HandleExit
   
   mstrLastName = rData
HandleExit:
End Property

Public Property Get FirstName() As String
   On Error GoTo HandleExit
   
   FirstName = mstrFirstName
HandleExit:
End Property
Public Property Let FirstName(rData As String)
   On Error GoTo HandleExit
   
   mstrFirstName = rData
HandleExit:
End Property

Public Property Get MiddleName() As String
   On Error GoTo HandleExit
   
   MiddleName = mstrMiddleName
HandleExit:
End Property
Public Property Let MiddleName(rData As String)
   On Error GoTo HandleExit
   
   mstrMiddleName = rData
HandleExit:
End Property

Public Property Get Salutation() As String
   On Error GoTo HandleExit
   
   Salutation = mstrSalutation
HandleExit:
End Property
Public Property Let Salutation(rData As String)
   On Error GoTo HandleExit
   
   mstrSalutation = rData
HandleExit:
End Property

Public Property Get Title() As String
   On Error GoTo HandleExit
   
   Title = mstrTitle
HandleExit:
End Property
Public Property Let Title(rData As String)
   On Error GoTo HandleExit
   
   mstrTitle = rData
HandleExit:
End Property

Creative Commons License
People Names by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 5,550 times.  This page was last modified 02:25, 15 May 2013 by Walter Niesz. Contributions by BruceM and Glenn Lloyd  Disclaimers