Log in

View Full Version : Search word documents within Access



emk
05-04-2009, 11:43 AM
Hello,
I have an Access Database that holds many word documents. I would like to be able to search for specific words within the documents. How would I do that?

CreganTur
05-04-2009, 11:53 AM
I have an Access Database that holds many word documents.

How are they held within the database? OLE objects, hyperlinks, etc?

emk
05-04-2009, 11:55 AM
Here's the code for the onClick in the form. Does this help?

Private Sub LstDocuments_Click()
On Error GoTo Err_Handler
Screen.MousePointer = 11

'Dim WordApp As Object
'Set WordApp = CreateObject("Word.Basic")

With rstDocs
.MoveFirst
Do While Not .EOF
If !ProcedureNumber = LstDocuments.Value Then
DocName = "\\oaitsd\ISFILE\Technology (file://\\oaitsd\ISFILE\Technology) Services\SDC\Operations\" & rstDocs!FileName
' Set a reference to the Word Application object.
Dim WordApp As Word.Application
Set WordApp = New Word.Application
WordApp.Visible = True
WordApp.Documents.Open DocName
Exit Do
End If
.MoveNext

Loop
End With
Screen.MousePointer = 0

Exit Sub
Err_Handler:
If Err.Number = 5174 Then
Dim response As String
response = MsgBox("The file you request does not exist.", vbOKOnly, "User Notification Screen")
Else
MsgBox Err.Description
End If
Screen.MousePointer = 0
WordApp.Quit
Debug.Print Err.Number
Debug.Print Err.Description
End Sub