Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Get file name from listbox selection.

    I do actually need help on this one. I've exhausted evything I can think of.

    I'm using this code:
    http://www.utteraccess.com/forum/Pop...-t1209291.html

    I want to leave it exactly as it is. When the user double clicks a template it will open for them to review.
    But, what I want is just the file name thats highlighted so I can use it as a variable in other code.

    (including the file extension.)



    I can then simply add this to the file path and run my other code on it.

    Would really appreciate the help.

    Thanks, Andy.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I would suggest you don't leave it as it is.
    To my mind that's a very badly designed listbox with one column containing file name with no extension, file purpose and date each separated by _____
    It's also hard coded to root of C:\ drive

    Much better to have 3 separate columns, include the extension and a button that opens a folder dialog to select a folder.
    Better still do the same as a continuous or datasheet subform
    Last edited by isladogs; 07-31-2018 at 01:46 PM. Reason: Grammar
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You my also get some ideas from Allen Browne's article on Listing Directories and http://allenbrowne.com/ser-59.html
    I agree with Colin, the display is confusing and is dealing at root level.

  4. #4
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    appreciate the replies, looks like I have some more work to do.

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Much better and easy to understand. Thanks both for the sugestions.

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

Similar Threads

  1. Using the listbox item selection
    By George in forum Modules
    Replies: 16
    Last Post: 09-10-2017, 11:03 PM
  2. Replies: 10
    Last Post: 06-18-2013, 02:00 PM
  3. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  4. Deleting a ListBox Selection
    By dreamnauta in forum Programming
    Replies: 4
    Last Post: 01-27-2012, 03:14 PM
  5. Cancel listbox selection
    By vba-dev in forum Access
    Replies: 0
    Last Post: 10-26-2009, 12:18 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
  •  
Other Forums: Microsoft Office Forums