"QryEGroup" opens without error?
All of the fields in queries "QrySupvTLPDue" and "QryEGroup" are the same?
In the function Egroup(), did you change the 2nd from the last line to "Egroup = eAdr"?
You don't need the lines
Code:
Dim Action As DAO.Database (not used)
With Rs (you are explicitly using "Rs" for the recordset variables)
End With
-----------------------------
If the queries have the same fields, you could use one function by turning it into a parameter function:
Code:
Public Function EmailGps(pQryName As String) As String
Dim Rs As DAO.Recordset
Dim eAdr As String
Set Rs = CurrentDb.OpenRecordset(pQryName, dbOpenForwardOnly)
If Not Rs.EOF And Not Rs.BOF Then
Do Until Rs.EOF
If Rs![EmailAd] <> "" Then
eAdr = eAdr & Rs!EmailAd & ";"
End If
Rs.MoveNext
Loop
End If
Rs.Close
Set Rs = Nothing
eAdr = Left(eAdr, Len(eAdr) - 1)
EmailGps = eAdr
End Function
Usage would be:
Code:
SomeVariable = EmailGps("QrySupvTLPDue")
AnotherVariable = EmailGps("QryEGroup")