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

Microsoft 365 and Office Development Other
Microsoft 365 and Office Word For business Windows
Microsoft 365 and Office Access For business Windows
{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.