• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 64
  • Last Modified:

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

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 van Roosmalen
Stefan van Roosmalen
  • 2
  • 2
1 Solution
John TsioumprisSoftware & Systems EngineerCommented:
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...
Stefan van RoosmalenTeamleader Service DeskAuthor Commented:
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?
John TsioumprisSoftware & Systems EngineerCommented:
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
    Set rs = New ADODB.Recordset
 rs.Open "select  * FROM YourTable where AA=10;", conn, adOpenStatic, adLockOptimistic
rs!fieldA= ValueA
rs!fieldX= ValueX


Open in new window

Check the driver version in order for the connection string to work
Stefan van RoosmalenTeamleader Service DeskAuthor Commented:
Thanks! This is the way to go...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now