Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Phillip Dade Phillip Dade is offline
external usenet poster
 
Posts: 1
Default Word 2002 Mailmerge using data from MySQL

Hi

I have been trying to set up a mail merge using data within a mysql database
and using an ODBC connection. I have succeeded in setting this up and all
'test' connections are working fine, however when I click 'ok' within the
'connection' tab of the data link properties; I get a prompt appear entitled
Mail Merge with the following statement contained within: 'Record 1 contained
too few data fields' this repeats itself through each row of the database.
Does anybody know of a way around this? I have tried the same set up using
Open Office and that seemed to work.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word 2002 Mailmerge using data from MySQL

If you're seeing the data link properties, you're probably actually
connecting via OLE DB, using the OLE DB provider for ODBC data sources, and
in my experience Word doesn't usually work with that very well.

In this case it's probably going to be easier doing the connection using
VBA, in which case you need something like the following if you're using a
system or user DSN:

Sub Connect2mySQL()

ActiveDocument.MailMerge.OpenDataSource _
Name:="", _
Connection:="DSN=your mySQL ODBC dsn name;PWD=your mySQL password;", _
SQLStatement:="SELECT * FROM mytable", _
SubType:=wdMergeSubTypeWord2000

End Sub

or like the following if you're using a file DSN:

Sub Connect2mySQL()

ActiveDocument.MailMerge.OpenDataSource _
Name:="the full path name to your .dsn file", _
Connection:="FILEDSN=the full path name to your .dsn file;PWD=your mySQL
password;", _
SQLStatement:="SELECT * FROM mytable", _
SubType:=wdMergeSubTypeWord2000

End Sub

You might also need the UID= parameter (mySQL user ID) if it isn't in your
DSN.
You should only need to run the macro once to set up the data source - after
you've saved the document, the connection should be re-made on re-open
(forgetting about the SQL prompt).

If you're not familiar with how to run VBA macros, see

http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

Peter Jamieson

"Phillip Dade" Phillip wrote in message
...
Hi

I have been trying to set up a mail merge using data within a mysql
database
and using an ODBC connection. I have succeeded in setting this up and all
'test' connections are working fine, however when I click 'ok' within the
'connection' tab of the data link properties; I get a prompt appear
entitled
Mail Merge with the following statement contained within: 'Record 1
contained
too few data fields' this repeats itself through each row of the database.
Does anybody know of a way around this? I have tried the same set up using
Open Office and that seemed to work.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2002 MailMerge & Access 2002 Victor Lazlo Mailmerge 2 May 27th 09 04:57 PM
Word 2002: Printing in mailmerge. gracie Microsoft Word Help 1 November 23rd 06 05:35 PM
Word 2002 - Mailmerge templates changing data source via VB newschapmj1 Mailmerge 2 May 9th 06 11:51 AM
Word (2002) cannot see Excel (2002) source data Matilda Mailmerge 3 July 14th 05 06:14 PM
±M·~ºô­¶±H¦sªA°È ¦P¨B¤ä´© PHP+MySQL, Access+ASP, ASP.NET, CGI, SSI ¹q¶l¯f¬r¹LÂo, ©U§£¹q¶l¹LÂo ¤ÎWebMail .................................................................................................................................................. [email protected] Page Layout 0 February 19th 05 10:27 AM


All times are GMT +1. The time now is 08:49 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"