Hi Traci
You can write a function which opens a recordset of the employees for the
given company (passed as an argument) and creates a string which is a list
of all the names. For example:
Function ListEmployees(CompanyID as long) as String
Dim rs as DAO.Recordset
Dim sList as String
Set rs = CurrentDb.OpenRecordset( _
"Select * from Employees where EmpCompany=" & CompanyID, _
dbForwardOnly)
With rs
Do until .EOF
sList = sList & !FirstName & " " & !LastName & vbCrLf
.MoveNext
Loop
.Close
End With
Set rs =- Nothing
' remove last Cr/Lf
ListEmployees = Left(sList, Len(sList)-2)
End Function
Now you can use this function in an expression in your query:
EmployeeList: ListEmployees([CompanyID])
....and then use the field EmployeeList as a merge field in your document.
This function lists one employee per line, but you might want to list them
some other way, say as a comma-separated list.
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
"Traci" <tm******@earthlink.net> wrote in message
news:Un*****************@newsread2.news.atl.earthl ink.net...
I need to do a mail merge letter from my database. The letter will be
addressed to small companies and in the body of the letter I need to list employees
of the company. There will be from 1 to 15 employees. My database is all set up
to provide the names and addresses of the companies and the list of employees
of each company. I need help on how to do the employee merge field when there
will be multiple employees to be listed in this field.
Anyone?
Thanks!
Traci