I have created an SQL database with a table called tblREP which has a single line of fields that I would now like to use to populate a microsoft word document.
In visual studio, I have created a button with the following code
However, I am getting this error:
This file could not be found.
(...\SQLEXPRESS;Initial Catalog=tree1;...)
Does anyone know where I am going wrong?
THanks
Frank
In visual studio, I have created a button with the following code
Dim w As New Word.Application Dim d As Word.Document Dim sqlstr As String sqlstr = "SELECT * FROM tblRep" d = w.Documents.Open("C:\...AIA.docx") Dim strConnection As String strConnection = "Data Source=*****\SQLEXPRESS;Initial Catalog=tree1;Persist Security Info=True;User ID=**;Password=******" d.MailMerge.OpenDataSource(strConnection, sqlstr) d.MailMerge.Execute() d.Close(False) w.Visible = True
However, I am getting this error:
This file could not be found.
(...\SQLEXPRESS;Initial Catalog=tree1;...)
Does anyone know where I am going wrong?
THanks
Frank