Public Sub IsHOH()

Dim oRels As CIndividuals2
Dim oRel As CIndividual2
Dim oConstit As CRecord

Set oConstit = New CRecord
oConstit.Init REApplication.SessionContext
'Pass in the system record ID of the constituent record to load
oConstit.Load 280

Set oRels = New CIndividuals2
oRels.Init REApplication.SessionContext, oConstit.Fields(RECORDS_fld_ID), tvf_Ind2_Spouse

'Check the spouse record for head of household value, return appropriate name
For Each oRel In oRels
If oRel.Fields(INDIVIDUAL2_fld_IS_HEADOFHOUSEHOLD) = 0 Then
MsgBox oConstit.Fields(RECORDS_fld_FIRST_NAME) & " " & oConstit.Fields(RECORDS_fld_LAST_NAME) & " is the head of household."
Else
MsgBox oRel.Fields(INDIVIDUAL2_fld_FIRST_NAME) & " " & oRel.Fields(INDIVIDUAL2_fld_LAST_NAME) & " is the head of household."
End If

'Clean up
oRel.Closedown
Next oRel

oRels.Closedown
Set oRels = Nothing

Set oRel = Nothing
oConstit.Closedown
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. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.