I'm assuming you're not using multivalued fields (if you are don't!)
Code:
Do While Not rs.EOF
If bIsMultiValue Then
'For multi-valued field, loop through the values
Set rsMV = rs(0).Value
Do While Not rsMV.EOF
If Not IsNull(rsMV(0)) Then
strOut = strOut & rsMV(0) & strSeparator
End If
rsMV.MoveNext
Loop
Set rsMV = Nothing
ElseIf Not IsNull(rs(0)) Then
strOut = strOut & rs(0) & strSeparator
End If
rs.MoveNext
Loop
right before this portion of code you may be able to do this:
Code:
dim iRecCt as long
rs.movelast()
iRecCt = rs.recordcount
rs.movefirst()
Then in your code have this:
Code:
Do While Not rs.EOF
If bIsMultiValue Then
'For multi-valued field, loop through the values
Set rsMV = rs(0).Value
Do While Not rsMV.EOF
If Not IsNull(rsMV(0)) Then
strOut = strOut & rsMV(0) & strSeparator
End If
rsMV.MoveNext
Loop
Set rsMV = Nothing
ElseIf Not IsNull(rs(0)) Then
if iRecCt = 2 Then
strOut = strOUT & rs(0) & " and "
else
strOut = strOut & rs(0) & strSeparator
endif
End If
rs.MoveNext
Loop
Then you would have to replace this:
Code:
lngLen = Len(strOut) - Len(strSeparator)
with
Code:
if iRecCt = 2 then
lngLen = Len(strout) - 5
else
lngLen = Len(strOut) - Len(strSeparator)
endif
where 5 is the length of the " and " string
NOTE, I haven't tested this but just giving you a little direction.