I don't believe it is a limitation of your function, however, I do know that
there is a limitation on the SQL statement.  Just exactly what it is, but I
have run into queries that I can't build.

Dawn Crosier
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and questions to
the newsgroup so that others can learn as well.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Joe
Sent: Wednesday, August 30, 2006 9:32 AM
To: [email protected]
Subject: [ms_access] Max number of characters on function NameString

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