Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word Integration with SQL Server

Status
Not open for further replies.

mmcshane

Programmer
Jul 23, 2004
5
US
I am trying to use a form in MS Word to capture data and put

that into a SQL Server Table using ActiveDocument in MS

Word. My question is the events I need to kick off my macro

are the Save and SaveAs events How would I do this?

Thanks
 
mmcshane:

You could use the Microsoft ActiveX Data Control Reference to do this. From your VBA window, in the menu bar, click on Tools > References... and check off the latest version of Microsoft ActiveX Data Controls (2.8).

Now, you'll be able to create an ADO Connection and Recordset, which you can use to transfer data between Word and SQL Server.

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
I have the MS ActiveX Data Objects 2.6 checked in my references window. Is this the one that your referring to that I should uncheck?

What I currently have is I am using the following code to pass parameters from inside Document_Close to my stored procedure:

Set cmd.ActiveConnection = connOLEDB
cmd.CommandText = "sp_Add293eSDoc"
cmd.CommandType = adCmdStoredProc

Set parOccurrence = cmd.CreateParameter("Occurrence", adVarChar, adParamInput, 10, dtmOccurrence)
cmd.Parameters.Append parOccurrence
parOccurrence.Value = dtmOccurrence

Set parReportDate = cmd.CreateParameter("ReportDate", adVarChar, adParamInput, 10, dtmReportDate)
cmd.Parameters.Append parReportDate
parReportDate.Value = dtmReportDate


But I really need to be able to execute this on a Save or SaveAs event. The only events I see are Document_Open, Document_New, Document_Close. I am not sure that I follow you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top