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!

Export Query as rtf for Mail Merge

Status
Not open for further replies.

alfonsomozo

Technical User
Mar 13, 2006
22
AU
I have a query to select specific contacts that works great thanks to PHV.
I want to export this data for use in a mail merge. I've seen some great posts on automatically sending the data over but what i need isn't that advanced.
Basically i want a button that will replicate me going
File->Export and then automatically seleting the file type *.rtf The user will then type in the desired filename.
thanks.
 
OK so i have made a macro using runcommand and then the export command. Is there any way to make *.rtf the default from withing the macro or easily in VBA?
thanks.
 
Have a look at the DoCmd.OutputTo method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Had a look at changing the code to
DoCmd.OutputTo acOutputQuery, "Contacts Query", acFormatRTF
which brings up a box to type in the where to save the file. Unfortunately it does not work though as it asks me what value the query should have for each field as it is getting its data from an open form. So it appears as if OutputTo is different to Export.
 
If the query you want to export is getting parameters data from a form then, obviously, this form must be open and populated at the OutputTo time like it was at the Export time ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I thought i replied here saying that the reason it wasn't working is because i closed the original form and thus the parameters were lost but obviously i didn't.
Well anyway yes that was the problem. Funnily enough though if i close the search form and then export as rtf it still works. They must be slightly different as when choosing a place to save they have different titles.
output to as opposed to export query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top