' Uncomment (Remove the ' ) the two lines of code below if they are not already at the top of your Module
'Option Compare Database
'Option Explicit

 
 
'-------------------------------------------------------------------------------------
' To use in a query, don't call the Function,
' just add the following line to a query column:
'     FullName:  FirstName & (" " + MI) & LastName & (" " + Suffix)
' FullName can then be used like a field in your Forms and Reports.
' Note: If your tables contain many records, this may slow down your query
'---------------------------------------------------------------------------------------
' Procedure : fFullName
' Author    : Unknown
' Purpose   : To cocantenate a full address
'           :
' Purpose   : fFullName can be used like a field on labels or reports.
' Arguments : strFirstName, strMI, strLastName, strSuffix are variables.  You can enter
'           : the actual names in quotation marks: ("Steve", "R.", "Thomas", "Sr.")
'           : or use any string variable for names: (strFName, strMI, strLName, strSuf)
'           : Use like this: Call fFullName(strFirstName, strMI, strLastName, strSuffix)
'---------------------------------------------------------------------------------------
'
Public Function functFullName(strFirstName As String, strMI As String, _
        strLastName As String, strSuffix As StringAs String
 
    ' If there is no MI or Suffix the + makes sure there
    ' are no extra blank spaces
    functFullName = strFirstName & (" " + strMI) & " " & strLastName & (" " + strSuffix)
 
End Function

 
' To use in a query, don't call the Function,
' Just add the following line to a query column:
'     SortName: LastName & ", " & FirstName & (" " + MI) & (" " + Suffix)
' Then you can choose sort your query by SortName
' Note: If your tables contain many records, this may slow down your query
' Your Query will run faster if you have individual FirstName and LastName Columns
'---------------------------------------------------------------------------------------
' Procedure : fSortName
' Author    : Unknown
' Purpose   : To cocantenate a full name so it can be sorted alphabetically
'           :
' Purpose   : fSortName can be used like a field on labels or reports.
' Arguments : strFirstName, strMI, strLastName, strSuffix are variables.  You can enter
'           : the actual names in quotation marks: ("Steve", "R.", "Thomas", "Sr.")
'           : or use any string variable for names: (strFName, strMI, strLName, strSuf)
'           : Use like this: Call fSortName(strLastName, strMI, strFirstName, strSuffix)
'---------------------------------------------------------------------------------------
'
Public Function fSortName(strLastName As String, strFirstName As String, strMI As String, strSuffix As StringAs String
 
    fSortName = strLastName & ", " & strFirstName & (" " + strMI) & (" " + strSuffix)
 
End Function

 
 
'---------------------------------------------------------------------------------------
' Procedure : fAddress
' Author    : Unknown
' Purpose   : To cocantenate a full address
'           : fAddress can be used like a field on labels or reports.
'---------------------------------------------------------------------------------------
 
Public Function fAddress(City As String, State As String, Zip As String, Nation As StringAs String
 
    fAddress = City & (" " + State) & (" " + Zip) & _
        (IIf(Nation = "US" Or Nation = "CA", "", (" " + Nation)))
 
End Function