Solved

How can I transfer data from MS Word to MS SQL tables?

Posted on 2016-11-04
4
46 Views
Last Modified: 2016-11-04
Hi there,
I would like to use MS Word to provide customers with a specific form.
When they have filled in this form, I would like to transfer the contents (fields) to a SQL database (Microsoft SQL).
How can I do this?
Kind Regards,
Stefan
0
Comment
Question by:Stefan van Roosmalen
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:John Tsioumpris
ID: 41873981
Usually its the other way around but is possible if you create a form and when the user fills the data to connect to MySQL and upload the data
So you need to start here in order to create a fillable form...
Then you get the ODBC driver from MySQL in order to establish a connection...
But personally i feel that using Word for this kind of job is somewhat an overkill....
If you have Access its much easier...
0
 

Author Comment

by:Stefan van Roosmalen
ID: 41874017
Hi John, thanks for your feedback.
Actually, making a form is not the problem. The real issue is how to transfer to MS SQL.
Can you help me with that?
0
 
LVL 16

Accepted Solution

by:
John Tsioumpris earned 500 total points
ID: 41874042
I guess you could go like this on a click event
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection

conn.connectionString = "DRIVER={MySQL ODBC 3.51 Driver};"_
& "SERVER=localhost;"_
& " DATABASE=test;"_
& "UID=venu;PWD=venu; OPTION=3"
conn.CursorLocation = adUseClient
    conn.Open
    Set rs = New ADODB.Recordset
 rs.Open "select  * FROM YourTable where AA=10;", conn, adOpenStatic, adLockOptimistic
rs.AddNew
rs!fieldA= ValueA
......
rs!fieldX= ValueX
rs.Update

rs.close
conn.close

Open in new window

Check the driver version in order for the connection string to work
0
 

Author Closing Comment

by:Stefan van Roosmalen
ID: 41874081
Thanks! This is the way to go...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question