Using Microsoft Word - how do I connect to a MySQL database residing locally on my computer so I can import information from MySQL to a Word FormField?
An example of the path: C:\InetPub\mshpar\cgibin\ar_person.def
Assuming you have installed the myODBC 2.50 or 3.51 driver, then in the Visual Basic Editor (Alt+F11 while in Word), you need to go to Tools-->References and add "Microsoft ActiveX Data Objects 2.7 Library". The 2.6 or 2.5 Library should also work, just choose the highest number that you have available.
The following should get you connected, after that it's pretty much like any other database.
Dim conn As ADODB.Connection
'connect to MySQL server using MySQL ODBC 2.50 Driver
Set conn = New ADODB.Connection
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.