'*******************************************************************************
' DCONCAT(expr, domain, [criteria],[delimiter])
'
' Function: to concate the columns string like group_concat() in Access.
' Parameter:
' expr : string, expression which can recognized by SQL.
' domain : string, the row source, can be another query.
' criteria : the ceritera which will be treated as the where clause.
' delimiter : delimiter between the column value, default is ",".
'
' Return: string, a String of concated columns,
' if err, return the err code + desc.
'
' history:
' 2009-Feb-28 ACMAIN New Creation
'
'*********************************************************************************
Public Function DCONCAT(sExpr As String, sDomain As String, Optional sCriteria As String, Optional sDelimiter As String = ",")
On Error GoTo ErrHandler
Dim rs As New ADODB.Recordset
Dim sSQL As String
Dim sResult As String
sResult = ""
sSQL = "select " & sExpr & " from (" & sDomain & ")"
If sCriteria <> "" Then
sSQL = sSQL & " where " & sCriteria
End If