Solved

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

Posted on 2016-11-04
4
54 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 17

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 17

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

632 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