I need help. I've got a module i'm running from a form which access a query and then takes that data and runs a word merge with a predetermined document.
My problem is I want to be able to select more than one refrence number (employee id) and have all information for 2 or more employees merge in different letters with the push of one button so my user doesn't have to keep going back and forth (they can select a grouping). It works great with one employee..but when you select two employees, it dumps all of the selected data from both employees onto one form. In other words if i pick Jon Doe and Jane Smith, I want both records to merge but to different letters. What is happening now is Jane Smith's records are merging at the bottom of Jon Doe's.
the module is as follows:
Function Merge_It()
Dim objWord As Word.Document
Set objWord = GetObject("H:\Database\resumes\Insp_Blank_merge.doc", "Word.Document")
' Make Word Visible.
objWord.Application.Visible = True
' Set the mail merge data source as the RESUME database.
objWord.MailMerge.OpenDataSource _
Name:="H:\Database\resumes\Master_res.mdb", _
LinkToSource:=True, _
Connection:="QUERY InspWthProjectsSelect", _
SQLStatement:="SELECT * FROM [InspWthProjectsSelect]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
I would also like it to close the first instance of word (the master merge document) and just leave the letters1.doc open for the user to use - is there away to do that.
Any and all help would be appreciated.
![[noevil] [noevil] [noevil]](/data/assets/smilies/noevil.gif)
"One of the secrets of life is to make stepping stones out of stumbling blocks." Jack Penn
My problem is I want to be able to select more than one refrence number (employee id) and have all information for 2 or more employees merge in different letters with the push of one button so my user doesn't have to keep going back and forth (they can select a grouping). It works great with one employee..but when you select two employees, it dumps all of the selected data from both employees onto one form. In other words if i pick Jon Doe and Jane Smith, I want both records to merge but to different letters. What is happening now is Jane Smith's records are merging at the bottom of Jon Doe's.
the module is as follows:
Function Merge_It()
Dim objWord As Word.Document
Set objWord = GetObject("H:\Database\resumes\Insp_Blank_merge.doc", "Word.Document")
' Make Word Visible.
objWord.Application.Visible = True
' Set the mail merge data source as the RESUME database.
objWord.MailMerge.OpenDataSource _
Name:="H:\Database\resumes\Master_res.mdb", _
LinkToSource:=True, _
Connection:="QUERY InspWthProjectsSelect", _
SQLStatement:="SELECT * FROM [InspWthProjectsSelect]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
I would also like it to close the first instance of word (the master merge document) and just leave the letters1.doc open for the user to use - is there away to do that.
Any and all help would be appreciated.
![[noevil] [noevil] [noevil]](/data/assets/smilies/noevil.gif)
"One of the secrets of life is to make stepping stones out of stumbling blocks." Jack Penn