I am trying to automatically save a word mail merge documents that has been generated from access.
I have generated some code that;
1. Opens the mail merge documents,
2. It then merges the mail merge documents to a new document based on a record in an access database.
3. We then go back to...
It is the last line.
With WordDoc
WordObj.Visible = True
.SaveAs ("C:\Users\NewDocument.docx")
End With
1. I open the mailmerge.docx.
2. Then there is command to merge the document (.ActiveDocument.MailMerge.Execute)which opens a new unnamed document. This is the documents we...
Yes Duane definitely deserves a star.
The letter will be a docx
Duane suggested changing the middle line. However this is the mail merge document that closes and then the merged document remains open.
So if I replace .Close savechanges:=False, with .SaveAs ("C:\Users\NewDocument.docx")...
Excellent, that does the job thank you very much.
One last thing and final request. I am trying to automatically save the merge file,
I was able to do this with excel. Something along the lines of.
ActiveWorkbook.SaveAs fileName:= _
"\\Agfgsdnewfs01\letter.xls", _...
See below, I have attached the code.
I do have a few other letters to produce and I suspect the second option may be easier to manage, but not sure how to code this.
I have attached the SQL regarding the first option.
Thanks
SELECT TBL_Owner.OwnerID...
Thanks for your patience Dhookham.
I seem to be making progress. This is now merging, and the letter appears although as we know the only merge field that appears is IDoptionpayments, and for the letter to work I will need to include about 20 fields.
The code below changes the query...
I am getting the following error message
Syntax error missing operator in query expression IDoptionpayments = 39 &'
It then opens up the merge documents showing all records. The query has been amended, and now shows only the IDoptionpayments merge field in the word documents and all the...
This seems to change the query, qry_landownerpayments2. So it is now just a query showing one record being 44, as opposed to the original with 115 records
I want to simply update the query or filter the query so it just selects record 44. I wanted to see if it would work with 44
Ideally it...
Yes it is the IDoptionpayments field that I am merging. It was always this IDoptionpayments even though I referred to it as IDPayments above.
I have simply tried to amend this field so it is IDoptionpayments=44.
Hopefully when it is working I will try...
I seem to be having some luck with the mail merge option.
I seem to have sorted out the ODBC issue by creating the word merge file from access.
The code now works and opens the document and merges the document.
However it does not work if I refine the query and put the following in the...
Thanks Dhookom
I have got this to work, albeit I am now extracting from the current access form and using bookmarks in word, to insert fields from access into word. Ideally I would rather use the mailmerge, but this is a good interim solution.
The only problem I now have is that if I have a...
I might just go back to a standard Microsoft access report although this is not ideal.
The select queries or variable queries do not appear to work from access. Actually I noticed they do not appear in Microsoft word if you want to merge from a query. I.e Forms]![frm_name]![Feild], or...
Thanks for your reply, sounds like a good suggestion.
I tried setting up the mail merge from access, and I get this message pop up in word, ODBC driver login failed, it is then asking for authorisation. I played around with some of my security settings in word, but no luck.
This thread deals...
I have a fairly simple request and I have been looking all over the internet for an answer.
All I want to do is;
Click on a button in access;
1. It opens a mail merge word document that has already been setup and linked to a query in the access database.
2. The document then merges to one...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.