I used the function bellow for about 2 years and never had a problem 
until I got to a point where this function combined about 9 people 
and reached more then 255 characters, and report does not display all 
names.

Your help is very appreciated.

Thank you

Function NameString(RecordID As Variant, TableName As String, _
                                    FieldName As String) As String

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim AssignmentID As Long
Dim FirstName As String
Dim MiddleName As String
Dim LastName As String
Dim Suffix As String
Dim Add As String
Dim NameList As String

NameList = ""

RecordID = Nz(RecordID, 0)
strSQL = "SELECT * FROM [" & TableName & _
                "] WHERE [" & FieldName & "] = " & RecordID & ";"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

If rs.RecordCount > 0 Then
Do While Not rs.EOF '<<
'    NameList = ""
    FirstName = Nz(rs(1) + " ", "")
    MiddleName = Nz(rs(2) + " ", "")
    LastName = Nz(rs(3) + " ", "")
    Suffix = Nz(rs(4) + " ", "")
    Add = Nz(rs(5) + " ", "")
      
    NameList = NameList & FirstName & MiddleName & _
                            LastName & Suffix & Add & " "
    'NameList = Trim(NameList)
rs.MoveNext
Loop
End If

NameString = NameList
End Function






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to