Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 48

Open external file with command button

  1. #31
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Alright, it randomly works perfectly now. Maybe I just hadn't saved everything the last time or something.

    Thanks!

  2. #32
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    'Randomly works' is not a solution.

    Private Sub Command599_Click()
    If IsNull(Me.EventID) Then
    Application.FollowHyperlink "\\SPARE\SharedDocs\Rob's Valet Docs\Valet Proposals"
    Else
    Application.FollowHyperlink "\\SPARE\SharedDocs\Rob's Valet Docs\Valet Proposals" & IIf(Dir("\\SPARE\SharedDocs\Rob's Valet Docs\Valet Proposals\" & Me.EventID) = "", "", "\" & Me.EventID)
    End If
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #33
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Aaaand it decided to stop working. Out of nowhere, it now doesn't open up the individual folders. It just opens up the parent folder, regardless of whether the particular event has a subfolder or not.

  4. #34
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    You tried code suggested in my previous post?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #35
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I did. It stopped working, so I changed it to your code, and still same result.

  6. #36
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    Don't know what to say. Unless EventID is null in every record, the code should work.

    Step debug. Refer to link at bottom of my post for debugging guidelines.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #37
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    I'm doing the step debug according to the instructions in the link at the bottom of your post, but nothing's happening. The code isn't showing any error, so nothing is highlighted yellow. I put the cursor at the beginning of a line and hit F8, and nothing happened. Am I doing something wrong, or is there just technically nothing wrong with the code?

  8. #38
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    I thought you said it is opening the parent folder? If so, something is happening.

    Code is behind button named Command599? Its Click event property is set to [Event Procedure]? You click the button?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #39
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    It is opening the parent folder. It's acting as if every event has an ID of null, but that's definitely not the case.

    Yes, code is behind button named Command599, which is the correct button to be behind, and the click event property is set to [Event Procedure]. I click the button, and it always opens the parent folder, and has stopped opening Me.EventID.

    The code is exactly what you wrote earlier:

    Private Sub Command599_Click()
    If IsNull(Me.EventID) Then
    Application.FollowHyperlink "\\SPARE\SharedDocs\Rob's Valet Docs\Valet Proposals"
    Else
    Application.FollowHyperlink "\\SPARE\SharedDocs\Rob's Valet Docs\Valet Proposals" & IIf(Dir("\\SPARE\SharedDocs\Rob's Valet Docs\Valet Proposals\" & Me.EventID) = "", "", "\" & Me.EventID)
    End If
    End Sub

  10. #40
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    And the subfolders exist?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #41
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    The subfolders do exist. Just to make 100% sure, I'm opening up the parent folder, then in Access opening up an event that definitely has a folder with the name being the same as the EventID. Then I click the command button, and the parent folder opens.

  12. #42
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    Don't know what else I can do.

    Debugging shows that only the first FollowHyperlink line is executed? It shows EventID is Null?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #43
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    Debugging didn't show anything. I went through the step debug, and nothing happened at all.

    The command button is just acting as if EventID is null in every case.

  14. #44
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,222
    If nothing happened then no folder would open. You say the parent folder opens. So which is it - nothing happens or parent folder opens?

    Did you verify in debugging that EventID shows as null in the code or does it show the expected value?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #45
    bradp1979 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jul 2015
    Location
    San Francisco, CA
    Posts
    234
    When I tried to do step debug, nothing at all happened. I put the cursor at the beginning of a line, hit F8, and nothing happened.

Page 3 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Open an attachment using a command button
    By Eddy Sincere in forum Forms
    Replies: 3
    Last Post: 04-03-2015, 11:43 AM
  2. External script to call Command Button Click event handler
    By Sean Nakasone in forum Programming
    Replies: 5
    Last Post: 10-29-2014, 12:35 PM
  3. Command button open url
    By patrickmcdiver in forum Programming
    Replies: 2
    Last Post: 03-06-2012, 11:08 AM
  4. Command button to open Report
    By swagger18 in forum Programming
    Replies: 0
    Last Post: 11-17-2011, 02:56 AM
  5. Use a command button to open a form
    By johnpaul in forum Forms
    Replies: 24
    Last Post: 09-23-2010, 12:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums