View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan Marth Dan Marth is offline
external usenet poster
 
Posts: 1
Default .NET/Word 2003 Mail Merge Problem

I am trying to do a mail merge using C#.NET, Word 2003 and the code from
this http://www.codeproject.com/KB/cs/C__..._Mailmerg.aspx
article.................any help would be greatly appreciated!

This is the error I receive, "Word was unable to open the data source." I
have checked the username and password over and over and it works fine
outside the below code. Any ideas why I might be getting this error?

Object oConnection = "DSN=My_DSN;Uid=UserName;Pwd=Password;"; //The DSN
connection name

Object oQuery = "SELECT * FROM Fax_Data"; // The query to get data from the
DSN

Object oSubType = Word.WdMergeSubType.wdMergeSubTypeWord;

//Open the data source and merge the fields

wrdMailMerge.OpenDataSource("", ref oFileFormat, ref oMissing, ref oMissing,
ref oTrue, ref oMissing, ref oMissing, ref oMissing, ref oFalse, ref
oMissing, ref oMissing, ref oConnection, ref oQuery, ref oMissing, ref
oMissing, ref oSubType);