Hi,
I have a access database which I am running in access 2013. I am having the problem where one of the forms has code which opens the Word read only mail merge file, produces the error message "Run-time error '4605': The OpenDataSource method or property is not available because this command is not available for reading". I have only started having this error message since moving to Access 2013, I have tried making the file non-read only and this stops message appearing. However this is not a helpful solution as I need the file to be read only so it does not get accidental written over. Does any one know of a way to stop this message appearing without having to make the file non-read only. Bleow is the code which opens the mail merge file:
Code:
Dim strFilePath As String
Dim objWord As Word.Document
DoCmd.RunMacro "AppRefnew"
strFilePath = "C:\Letter1.docx"
Set objWord = GetObject(strFilePath, "Word.Document")
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource _
Name:="C:\database1", _
LinkToSource:=True, _
Connection:="TABLE datatable", _
SQLStatement:="SELECT * FROM [datatable] WHERE [AppRefID]=[Ref2]"
Set objWord = Nothing