Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

merge more than one record at a time 1

Status
Not open for further replies.

WebGodiva

Technical User
Jun 21, 2000
263
US
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]

"One of the secrets of life is to make stepping stones out of stumbling blocks." Jack Penn
 
There are a several FAQs on mailmerge. This one:
'Native' mailmerge reports - as painless as possible
faq181-5088
May suit.
 
thanks, i'll give it a try - a lot of code to go through - i'm just learning so it will take a while - i do truly appreciate your help.



[noevil]

"One of the secrets of life is to make stepping stones out of stumbling blocks." Jack Penn
 
I think you will find that it is easier than it looks at first glance. This:
Creating Word documents for multiple records
thread702-1167168
Has some notes on the FAQ that may (or may not) be useful.
 
Thanks - it's works great!!

i can stop banging my head now...i guess working with three seperate databases is too much for me right now....need to take it one step at a time.

again, much appreciated..

[noevil]

"One of the secrets of life is to make stepping stones out of stumbling blocks." Jack Penn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top