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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text in SQL statement 1

Status
Not open for further replies.

brd24gor

MIS
May 18, 2005
123
US
Using ver. 2003

I am having some problems putting text from a Word doc into an Access table field. I have an Outlook task form I am writing VBScript behind to do this to put text into a work order. The problem is stemming from contructing the SQL statement. Here is my code thus far:

set myWord = CreateObject("Word.Application")
myWord.Documents.Add
myWord.Visible = True

<code that adds text to my Word doc> --unimportant

mySQL="UPDATE Tasks SET Tasks.Note=" & <problem area> & " WHERE Tasks.WO_Num=" & myWO

where <problem area> explains itself. What I would like to do here is take the text of the Word document I have just created & saved and put it into this database field. Is there a method or property in Word that will return something the SQL statement will read as a string or text?

Any ideas would be greatly appreciated!
Thanks,
Brad
 
Hi Brad,

Have you tried myWord.ActiveDocument.Content?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks, that was exactly what I was looking for! Now I just need to make sure I don't have any apostrophies or quotes in there...

Thanks again,
Brad
 
mySQL="UPDATE Tasks SET Tasks.Note='" & Replace(myWord.ActiveDocument.Content, "'", "''") & "' WHERE Tasks.WO_Num=" & myWO

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top