Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help text file (XP/SR2)

    I'm developing a database to store examination records that eventually I will pass on to a colleague.
    I want to add a help file to it that can be accessed by clicking on a button, preferably in the form of a Word document. Is there any way I can get Access to open a Word document located in the same folder as the database itself, without naming the path folder (which will obviously change when it goes on to someone else's computer) in the macro or event procedure?

    thanks in advance

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: help text file (XP/SR2)

    Put the following code at the top of a module:

    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Public Const SW_SHOWMAXIMIZED As Long = 3

    To open the document, use code like this:

    Private Sub cndHelp_Click()
    Dim lngResult As Long
    Dim strPath As String

    strPath = CurrentProject.Path
    If Not Right(strPath, 1) = "" Then
    strPath & strPath & ""
    End If

    lngResult = ShellExecute(hWndAccessApp, "Open", _
    strPath & "MyHelpfile.doc", 0&, 0&, SW_SHOWMAXIMIZED)
    If lngResult <= 32 Then
    MsgBox "Could not open the help file.", vbExclamation
    End If
    End Sub

    Substitute the filename of the Word document.

  3. #3
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: help text file (XP/SR2)

    thanks so much--my apologies that the e-mail got stuck in my inbox.

    best

    Philip

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •