J
JLJones13
I have a query that derives a list of Recipients for a specified e-mail.
The Recipients are in a table and are linked through a GUID. The field
Recipient is data type Memo and the field RecipientDisplayName is text. If
I use both of these fields (as in the code below), my field won't go beyond
255 characters. If I only use the memo field Recipient the query field
returned is memo, also.
I have tried: CStr(), Trim(), Left() with the query line
RecptList(![MailboxMsgDetailsSentGUID]) and none of them make a
difference.
How can I make the query field Recipients a Memo field?
Thank you for your help!
Here's the SQL and the Function RecptList.....
SELECT S.MailboxMsgDetailsSentGUID, S.MailboxDN, S.MailboxEmail,
S.MessageID, S.Date, S.Subject, S.SizeKBytes,
RecptList(![MailboxMsgDetailsSentGUID]) AS Recipients
FROM dbo_T_MailboxMsgDetailsSent AS S;
Function RecptList(lMsgGUID As String) As String
Dim db As Database
Dim rs As Recordset
Dim sSQL As String
Dim sReturn As String
sSQL = "SELECT R.Recipient, R.RecipientDisplayName" & _
" FROM dbo_T_MailboxMsgDetailsSentRecips AS R" & _
" WHERE R.MailboxMsgDetailsSentGUID = " & lMsgGUID
Set db = CurrentDb()
Set rs = db.OpenRecordset(sSQL)
If rs.BOF And rs.EOF Then
sReturn = ""
Else
rs.MoveFirst
Do While Not rs.EOF
'if the display name is there, use it..
If Not IsNull(rs![RecipientDisplayName]) Then
sReturn = sReturn & rs![RecipientDisplayName] & ";" 'this
field is type TEXT
Else
'if not, extract the e-mail address and append it to the list.
sReturn = sReturn & FrmtMailName(rs![Recipient]) & ";" 'this
field is type MEMO
End If
rs.MoveNext
Loop
End If
rs.Close
db.Close
RecptList = sReturn
End Function
The Recipients are in a table and are linked through a GUID. The field
Recipient is data type Memo and the field RecipientDisplayName is text. If
I use both of these fields (as in the code below), my field won't go beyond
255 characters. If I only use the memo field Recipient the query field
returned is memo, also.
I have tried: CStr(), Trim(), Left() with the query line
RecptList(
difference.
How can I make the query field Recipients a Memo field?
Thank you for your help!
Here's the SQL and the Function RecptList.....
SELECT S.MailboxMsgDetailsSentGUID, S.MailboxDN, S.MailboxEmail,
S.MessageID, S.Date, S.Subject, S.SizeKBytes,
RecptList(
FROM dbo_T_MailboxMsgDetailsSent AS S;
Function RecptList(lMsgGUID As String) As String
Dim db As Database
Dim rs As Recordset
Dim sSQL As String
Dim sReturn As String
sSQL = "SELECT R.Recipient, R.RecipientDisplayName" & _
" FROM dbo_T_MailboxMsgDetailsSentRecips AS R" & _
" WHERE R.MailboxMsgDetailsSentGUID = " & lMsgGUID
Set db = CurrentDb()
Set rs = db.OpenRecordset(sSQL)
If rs.BOF And rs.EOF Then
sReturn = ""
Else
rs.MoveFirst
Do While Not rs.EOF
'if the display name is there, use it..
If Not IsNull(rs![RecipientDisplayName]) Then
sReturn = sReturn & rs![RecipientDisplayName] & ";" 'this
field is type TEXT
Else
'if not, extract the e-mail address and append it to the list.
sReturn = sReturn & FrmtMailName(rs![Recipient]) & ";" 'this
field is type MEMO
End If
rs.MoveNext
Loop
End If
rs.Close
db.Close
RecptList = sReturn
End Function