Hyperlink in access 97

  • Thread starter Thread starter Peter McCartney
  • Start date Start date
P

Peter McCartney

Hello all! Thanking anyone for a reply. A97

I have a command button on my main form with a hyperlink address to a
specific word document. But when I quit that word document, my database is
minimised, and the windows screen appears.

Hyperlink address is: C:\AAA Training Class\Training\contacts\class
contacts.doc

How can I have it that when I quit the specific word document it takes me
back within my database on my mainform.

Peter McCartney
 
I found this on a Goggle search. The code is from Alastair MacFarlane.
Search found under "Access forms + word documents" Thanks to Alastair
MacFarlane.
Opens my word document & when I quit or close I return to my access
database. No hyperlink needed here!!
Tested it & found it to work Great!


Alastair MacFarlane states:

The following code will open a word document as long as
you have the Word object library loaded into your
references:

********************************
Private Sub FilePath_Click()
On Error Resume Next
Call LoadWordFile("c:\my documents\blue team.doc")
End Sub
********************************
Private Sub LoadWordFile(strWordDoc As String)
On Error GoTo err_handler:
Dim wrdApp As Word.Application
If FileExist(strWordDoc) = False Then Err.Raise 5273
Set wrdApp = New Word.Application
With wrdApp
.Documents.Open strWordDoc
.Visible = True
.WindowState = wdWindowStateMaximize
End With
exitSub:
Exit Sub
err_handler:
Select Case Err.Number
Case 5273
MsgBox "The requested file is no longer at the current location.
" & vbCrLf & _
"This could be because the file has been deleted, moved
" & vbCrLf & _
"or renamed. Access will not open this document!",
vbCritical, "Missing File Warning"
Case Else
MsgBox Err.Description, vbOKOnly, "System Information """
End Select
Resume exitSub:
End Sub
********************************
Private Function FileExist(Filename As String) As Boolean
If Dir$(Filename) = "" Then
FileExist = False
Else
FileExist = True
End If
End Function
*********************************
 
Back
Top