How to create a MS Word mail merge using an MS Access query with a criteria of Username

Matt Gilbert 0 Reputation points
2024-07-20T03:07:16.8233333+00:00

I have an MS Word document that I would like to populate with username details, namely; FirstName, LastName, PhoneNo, MobileNo & EmailAddress. I have an MS Access database that has a table called tblUsers with these fields plus a UserName field (FirstName.LastName). I have another table called tblProjects with project information. I have created an MS Access query that combines these 2 tables and has NetUser() as a criteria for the UserName field. NetUser code as follows;

Function NetUser()
Dim objNet
Dim strUser As String
Dim strDomain As String
    Set objNet = CreateObject("WScript.Network")
    strUser = objNet.UserName
    Set objNet = Nothing
NetUser = strUser
End Function

The query lists all projects with same username details against each one. I then try and create a mail merge between word document and this query however the query does not appear in the list of available queries in mail merge wizard window. I understand that parameter queries cannot be used in a mail merge but why can't this query? How can I get around this or is there another method to achieve same result? Thanks in advance. Matt

Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
871 questions
Access
Access
A family of Microsoft relational database management systems designed for ease of use.
398 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,963 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.