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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query linked to Word document

Status
Not open for further replies.

BDawg04

Programmer
Jan 6, 2005
15
US
I have a Word document that is supposed to be tied to a query in my database for a mail merge. For some reason it doesn't work. This whole thing was created before I started my job so I'm not sure what query is linked to the Word document. Is there a way to tell which query is linked other than searching through each query for the necessary fields? I've already been loooking for about 2 hours now and I'm getting frustrated. I will probably just create another query here in a little bit but my boss seems to think there is a way to tell which query is linked to the Word document. Any help is greatly appreciated.
 
When in your MailMerge word document go to VBE (Alt-F11) and in the debug window (Ctrl-G):
? ActiveDocument.MailMerge.DataSource.QueryString

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I pasted that line in there but I'm getting compile errors. I type CTRL+g and the bottom window opens. I paste the code in there and hit run. It wants me to save or create a macro. I saved it as test and tried to run but only got errors. I know I've done something wrong but I don't know what. Thanks for any more information.
 
You should be able to get it from within the mail merge helper. Open the word document. Turn on the mail merge toolbar. Find the mail merge helper button. Under number 2 the data source it will name the database and query being used. Hope this helps.

Alan
Senility at its finest
 
We are having problems with several mail merges now. Things are getting real fun. I'll try that later to see if it works. Thanks for the help.
 
I've tried several things from different people and none have worked. I think I have a different version than some people. Or maybe I'm just sutpid. I have Word 2002. If anyone has some other suggestions I would love to hear them. I'm in the process of creating a brand new query for this mail merge and it is a little confusing and time consuming. Thanks for the help.
 
We are using Access and I have been unable to run any of my prior mail merges from Access 2000 once we upgraded to Access 2002 if the merge was tied to a query. It works fine if you associate it with a table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top