I have just installed Access 2003 on my machine and opened up an access file developed in 2000.
The problem is that some of the functionality appears to have been lost.
For instance
I have a mail merge document that when I click on a button within Access; the word document opens and populates the fields with a query that is linked to the current record that I am in. The query includes the criteria [Forms]![Main]![sheet1]![ID], which ensures only the current record is selected, the code below worked fine in Access 2000 and word 2000
Private Sub Command174_Click()
Dim stDocName As String
On Error GoTo Err_Command174_Click
Dim WordObj As Word.Application
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open ("C:\Documents and Settings\andouk\My Documents\andrewd\database\CAAletter.doc")
WordObj.Visible = True
With WordObj
.ActiveDocument.MailMerge.Execute
End With
With WordObj
Set WordDoc = .Documents.Open("C:\Documents and Settings\andouk\My Documents\andrewd\database\CAAletter.doc")
End With
With WordDoc
.Close SaveChanges:=False
End With
Exit_Command174_Click:
Exit Sub
Err_Command174_Click:
MsgBox Err.Description
End Sub
I receive the following error message in Access 2003, the method or property is not available because the document is not a mail merge main document
Can anybody suggest what the problems is as I would have thought it would be fairly straight forward to fix however I am pulling my hair out trying to resolve this.
Note that if I open the document in word it opens up as a mail merge document and therefore the word document is a mail merge document.
If I create a hyperlink button from access it also opens up in word, but it can take up to 5 minutes and is very slow.
However I would like to be able to automatically merge the document then close the merged document as shown in the attached code above.
Any ideas on the revised code that may work in access 2003 or what is causing the problem would be appreciated.
PS both word and access document were created in access 2000 and I have upgraded word and access to 2003
Thanks
The problem is that some of the functionality appears to have been lost.
For instance
I have a mail merge document that when I click on a button within Access; the word document opens and populates the fields with a query that is linked to the current record that I am in. The query includes the criteria [Forms]![Main]![sheet1]![ID], which ensures only the current record is selected, the code below worked fine in Access 2000 and word 2000
Private Sub Command174_Click()
Dim stDocName As String
On Error GoTo Err_Command174_Click
Dim WordObj As Word.Application
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open ("C:\Documents and Settings\andouk\My Documents\andrewd\database\CAAletter.doc")
WordObj.Visible = True
With WordObj
.ActiveDocument.MailMerge.Execute
End With
With WordObj
Set WordDoc = .Documents.Open("C:\Documents and Settings\andouk\My Documents\andrewd\database\CAAletter.doc")
End With
With WordDoc
.Close SaveChanges:=False
End With
Exit_Command174_Click:
Exit Sub
Err_Command174_Click:
MsgBox Err.Description
End Sub
I receive the following error message in Access 2003, the method or property is not available because the document is not a mail merge main document
Can anybody suggest what the problems is as I would have thought it would be fairly straight forward to fix however I am pulling my hair out trying to resolve this.
Note that if I open the document in word it opens up as a mail merge document and therefore the word document is a mail merge document.
If I create a hyperlink button from access it also opens up in word, but it can take up to 5 minutes and is very slow.
However I would like to be able to automatically merge the document then close the merged document as shown in the attached code above.
Any ideas on the revised code that may work in access 2003 or what is causing the problem would be appreciated.
PS both word and access document were created in access 2000 and I have upgraded word and access to 2003
Thanks