View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge Word/Excel Dilaogue/Database Engine error

I don't know what the problem is, but if it's intermittent and only occurs
when the document is opened, I would try to go the macro route, i.e.
a. create an AutoOpen macro in the document, say

Sub AutoOpen()

Dim strPathName As String
Dim strSheetRangeName As String
Dim strQuery As String

' Put the pathname of your Excel workbook here
strpathName = "c:\myworkbooks\mywb.xls"

' Put the name of the Sheet (or the range name) here
strSheetRangeName = "Sheet1$"

' Construct the Query - you may also need WHERE and ORDER BY
' clauses for filtering and sorting

strQuery = _
"SELECT * FROM `" & _
strSheetRangeName & _
"`"

' The following should be enough in Word 2003

ActiveDocument.MailMerge.OpenDataSource _
Name:=strPathName, _
SQLStatement:=strQuery

' Set the merge type you want
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters

' optionally set the destination you want
ActiveDocument.MailMerge.Destination = wdSendToNewDocument

End Sub

b. ensure the data source is disconnected from the document (click the
first button in the Mail Merge toolbar and check the Normal Word Document
option)
c. save the document

When the user has finished with the document, she either needs to close the
mail merge main document without saving it, or do (b) then (c).

Unfortunately you will probably also have to take account of the following
KB article:

"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document"
at
http://support.microsoft.com?kbid=825765

As for the cause of the existing problem, I can only offer a few ideas:
a. the Excel document might be corrupt
b. the Excel document might be very large (I don't run into that myself)
c. Is the Excel document on a network path?
d. is the Excel document path name long?
e. are sort/filter options specified? (but I think this only caused a
problem in Office XP)
f. is the user using a network roaming profile? If so, there is a
possibilty that there is a permissions problem with a temporary file/folder
somewhere.

Peter Jamieson
"havenlad" wrote in message
...
Thanks Peter

Word 2003
Yes she can disconnect - that is the only workaround she has.
The merge has worked before, and it has failed before - it is
intermittent.
(it failed when she logged into my machine)
The problem is only when she opens the document
The |Excel file ihas never been moved and it is not in use elsewhere
I do have access to the machine.

Hope all that helps
"Peter Jamieson" wrote:

Which version of Word?

Has this merge worked before?

Can you spell out what is going wrong, e.g. can you disconnect? Can you
reconnect? Does the problem occur when you connect/reconnect or only when
you open the document?

Is the Excel file being used by anything else?

(Do you have access to the client's machine?)

Peter Jamieson


"havenlad" wrote in message
...
A client is having major problems doing a mail-merge. Every time I try
to
open the document I get an error message stating "this operation cannot
be
completed because of dialog or database engine failures. please try
later"

Anybody's help would do me a huge favour

Thanks

Chris