Word Doc Search Query from Access

G

Guest

I have the following code to search word doc from access:

Sub label49()

Dim wrd As Object
Dim wrddoc As Object
Dim strFind As String
Dim binFound as Boolean
strFind = Inputbox("Enter Text to Find")
Set wrd = GetObject(" MY FILEPATH")
wrd.Applicaton.Visible = True


When I press on the search button for this, it does ask me which txt i wish
to find, however once ive entered in txt this error message appears:

Run-time Error '2147221020 (800401E4)';
Automation error
Invalid syntax

Would anybody be able to explain this and where i have gone wrong?

Thanks in advance
 
J

JohnFol

It would be usefull to know which line it fails on .. ..

Can I suggest you do this differently, using OLE Automation. Make a
reference to the Microsoft Word object library, and try something like this.

Dim objWord As Word.Application
Set objWord = New Word.Application
objWord.Documents.Open ("c:\myDoc.doc")
objWord.Visible = True
objWord.Documents(1).Close
Set objWord = Nothing
 
G

Guest

Would this mean i would have to create a module in access?
Im not familiar with OLE, as this is my first time at building a database..

Any info would be great thankyou.
 
J

JohnFol

It sounds like you already have a module as you have supplied some sample
code. . ...
 
G

Guest

The code that you have supplied doesnt seem to work, and the one I have
already doesnt seem to work either....
I already have a module and a form to 'attach' word documents to individual
clients. However am trying to be able to search these documents for a
specific word lets say 'display' and for a search to return clients names on
a form, those with documents with the word 'display' in them.... a complex
query for me unfortunately. any ideas? thanks.
 
G

Guest

the query i have below is all i have...
i have tried entering a filepath, but to no avail, it doesnt search.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top