Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Oct 2001
    Location
    Upper NY State, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A2000 minimizes after accessing hyperlink to file (Access 2000)

    I created a form which uses the file dialog api to search out a particular Word/Excel document and creates a hyperlink to said document. It works fine but when you access the links, the document opens and the entire Access app minimizes to the start bar. Any way to prevent this?

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

    Re: A2000 minimizes after accessing hyperlink to file (Access 2000)

    This question has been asked in the Microsoft Newsgroups several times without a satisfactory answer. For some users, Access minimizes, for others it doesn't.

    As an alternative, you can use another API function to open the document: ShellExecute.

    ' Windows API function

    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

    Private Sub OpenDoc(strFileName As String)
    Dim lngResult As Long
    lngResult = ShellExecute(hWndAccessApp, "Open", _
    strFileName, 0&, 0&, SW_SHOWMAXIMIZED)
    If lngResult <= 32 Then
    MsgBox "Couldn't open document.", vbExclamation
    End If
    End Sub

  3. #3
    Lounger
    Join Date
    Oct 2001
    Location
    Upper NY State, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A2000 minimizes after accessing hyperlink to file (Access 2000)

    Thank you for your insight and solution. Much like Microsoft, sometimes it works, sometimes it does not. We have learned to accept it.

    I thought I had a simple idea any user could use to hyperlink many documents to a projects database. I was thinking about using api calls to get the Access window handle, then have a hidden form running api calls on the form timer event to see if Access was minimized and them maximize/restore it. This would have taken me much time to figure out.

    I am using your solution.

    Cheers,

  4. #4
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A2000 minimizes after accessing hyperlink to f

    Hans,

    Could you tell me where this api procedure is to go within Access?

    Justin.

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

    Re: A2000 minimizes after accessing hyperlink to f

    You can copy the code from the post above, and paste it into a new module in Access. Since the OpenDoc function is declared as Public, it can be used anywhere in the database. With the same convention as in <post#=424725>post 424725</post#>, you would use

    Private Sub cboMycombo_AfterUpdate()
    OpenDoc Me.cboMycombo
    End Sub

    You seem to like asking the same question twice - see <post#=373079>post 373079</post#> and <post#=424766>post 424766</post#>, also <post#=402447>post 402447</post#> and <post#=423704>post 423704</post#>.

Posting Permissions

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