Word 2000 and 4198 error

Z

Zio Tapirone

Hi! I want to merge the records of my Mysql database with a Word
document.
I installed the ODBC driver, and when I merge the records "manually"
(using the menu commands and MS Query), it works correctly.
I recorded a macro to accomplish that work, and the resulting code is
the following one:

ActiveDocument.MailMerge.OpenDataSource Name:="",
ConfirmConversions:= _
False, ReadOnly:=False, LinkToSource:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False,
Format:=wdOpenFormatAuto, _
Connection:= _
"DRIVER={MySQL ODBC 3.51
Driver};DESC=;DATABASE=condomini;SERVER=localhost;UID=root;PASSWORD=;PORT=;OPTION=;STMT=;"
_
, SQLStatement:= _
"SELECT condominio_0.id, condominio_0.nome,
condominio_0.indirizzo, condominio_0.cap, condominio_0.citta,
condominio_0.provincia FROM condomini.condominio condominio_0" _
, SQLStatement1:=""
ActiveDocument.MailMerge.EditMainDocument

But, when I try to run the macro, it stops with a "run-time error
4198: command failed" (or something similar).
It is very strange, since I use the code generated by VBA without
modifying anithing.
Any suggestion?
M.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top