Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2020
    Posts
    5

    Open Folder

    Good afternoon. I am new to programming of any sort. I was recently asked to develop a database to track member records. As I've figured it out I've been requested to make changes but this 1 had ne stumped. My db has records for 300 members. Each member has a folder on the share drive that contains multiple documents that we have to maintain. The higher ups would like a button on the form that opens that members folders. I I have renamed all the folders to have the same format

    Lastname, firstname organization

    I was able to open the parent folder with the button, but have not been able to determine how to add this last branch via vba.

    Dim member
    Member = [last name] & ", "& [first name] & " " & [org]

    I've tried adding "member" and [member] to the end of file path but no avail.



    S:/command/parentfolder/"member"

    It hasnt worked. How can I add that specific information without having to create 300+ code lines?

    Thank you for any assistance you all can provide.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,676
    Concatenate literal text and variables.

    What is the actual line to open folder?
    Code:
    "S:/command/parentfolder/" & Member
    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. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,317
    Might be:

    filepath = "S:/command/parentfolder/ '" & [Member] & "'"

    single quote double quote' & [Member] & double quote single quote double quote

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,676
    The apostrophes are not needed for this concatenation - there is no SQL statement or filter criteria being constructed.
    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. #5
    Join Date
    Jan 2020
    Posts
    5
    Quote Originally Posted by June7 View Post
    Concatenate literal text and variables.

    What is the actual line to open folder?
    Code:
    "S:/command/parentfolder/" & Member

    Thank you, it worked. The code I'm running is as follows

    Private sub btndocs_click()
    Dim fldrname as string
    Dim member
    Member = me.last_name & ", " & me.first_name &" "& me.org
    Fldrnamr = "s:\yourpathe\parentfolder" & member

    Shell "c:\windows\exeplorer.exe """ & fldrname & "", vbnormalfocus
    End sub

    And it works great now. Thank you all for your quick responses.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,676
    Glad you got it working. Just realized your original code showed / instead of \.
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Open a file in a folder
    By LonghronJ in forum Modules
    Replies: 3
    Last Post: 04-29-2016, 02:39 PM
  2. Replies: 10
    Last Post: 09-09-2015, 03:25 AM
  3. Hyperlink to open folder on network
    By angie in forum Forms
    Replies: 3
    Last Post: 12-10-2013, 10:22 AM
  4. open folder/Make new folder(example)-VBA Code
    By Madmax in forum Code Repository
    Replies: 3
    Last Post: 03-13-2012, 09:17 AM
  5. Enter a folder name and open that folder
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 09-05-2010, 04:39 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