Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Mail merge access 2003 - 2007

Hi experts

At work we are going to change from office 2003 to 2007. We have mdb database and in one of the reports we use mail merge:

Wrd.Application.Documents.Open fileName:=Tekstfil, ReadOnly:=True
varSQL = "SELECT TEKST.POR, TEKST.PER_TWR, TEKST.PER_BENCH, TEKST.AAR_TWR, TEKST.AAR_BENCH FROM SASADMIN.TMSRAP_TEKST_DAOB TEKST WHERE TEKST.BNR = 'BATCH' AND TEKST.POR='" & PM & "'"
Wrd.ActiveDocument.MailMerge.DataSource.QueryString = varSQL
Wrd.ActiveDocument.MailMerge.Execute
Wrd.ActiveDocument.SaveAs (Ud_fil)
Wrd.Application.Quit (False)

When we use a 2003 version of access it copies a word file to "c:\temp\" and then get the text from that file. If i open the word file it has got the right values from the database. But in access 2007 it can't get the values?

The access database is a mdb file and the word document is a doc file.

I think the error is in the code above, because that is where is copies the word doc and sets the DataSource.
0
DCRAPACCESS
Asked:
DCRAPACCESS
1 Solution
 
DCRAPACCESSAuthor Commented:
Hi again

I have narrowed down the question, and found out that the attach picture was the problem.

I also found the solution :-)

by adding this:
NoEncodingDialog:=True

to the following line:
Wrd.Application.Documents.Open fileName:=Tekstfil, ReadOnly:=True, NoEncodingDialog:=True

i got it to work :-)

0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now