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

Trouble setting query as mailmerge data source for Word Document

Status
Not open for further replies.

crash111

Technical User
Aug 2, 2002
5
US
This sounds ridiculous, but here goes.

I have a database where we enter customer information into. I have created a button for users to click on a form that will print off a standard letter with the corresponding customer data on it; it is to just print off one letter at a time for the current customer. The form is based on a query.

I was trying to set my letter template with the query as the data source, but the query isn't listed as one of the views/queries available. All the other tables and queries are there, just not the ones that have a form field as the criteria to filter the query on.

How do I do this?

Thanks in advance.
 
I'm not sure I understand what you mean but this MAY help!
It is possible that the letter template does not use a query but is based on the customer table and only uses the fields that are required on the template.

You could do the same for a mailmerge or setup your own query which would be specific for the job and would allow you to apply filters on Town or Postcode etc...

Hope this helps

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
No, the letter really is based on a query that is created at runtime. I think that's the problem; I can base the letter on a table or I can base the letter on a query that isn't created at run-time, but that's it.

I did try running a make-table query to resolve this, and I was able to use the resultant table as my letter data source, but then I ran into the problems of having the alerts asking the user if they knew that the table was going to be deleted and recreated, etc. I don't know how to set these answers within the code. As the application's transition from Access to Word was supposed to be transparent, that solution didn't work.

 
Why not using a parametized saved query ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ok, how about
Code:
strYourSQL = "SELECT * FROM Table1 WHERE ID = " & me![ID] & ";"
currentdb.QueryDefs("QurtyName").SQL = strYourSQL
HTH
Peter
 
Hi all,
Thanks for all the suggestions, but I still can't get the Word document to see the query -- yes, it is a parameterized query -- as a data source for the mail merge. I think it is because it IS a parameterized query that it won't see it. I think I'll have to work around it. Thanks though!
 
I think that is the problem, parameterized queries are not "visible" from Word.

Take a look at this faq faq181-5088 with a different approach.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top