Results 1 to 6 of 6
  1. #1
    jimmyp75 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    3

    show filters files form a Folder

    I have looking for a way to show only certain files that are in a Specific Folder on my Network when i click a button in Access.



    The folder contains a large QTY (maybe 1000) of PDF files in it. the Filename contains a P.O. Number somewhere in it. (i.e. xxxxx-S)

    If i am looking at a P.O. Number record on a Form in Access...i want to be able to click a button and open Windows Explorer and show ONLY the files that have that particular P.O. # in the filename.

    I have tried using Listfiles.. and only got it working halfway. It will show the files like i want, but I would like to double click them to open them and that part is not working... so that leads me to the Windows Explorer.

    Any thoughts on what direction i need to take would be greatly appreciated.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    why not list the files recursively in a control on the form, maybe in a listbox or something? then on the doubclick event of the listbox, open the file via code, by way of using the selected name in the listbox?

  3. #3
    jimmyp75 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    3
    Quote Originally Posted by ajetrumpet View Post
    why not list the files recursively in a control on the form, maybe in a listbox or something? then on the doubclick event of the listbox, open the file via code, by way of using the selected name in the listbox?

    I used this...
    Call ListFiles("S:\GEIT\ShipTicketsandOrderConf", "*" & [JWJ_PO_Num] & "*", , Me.lstFileList)

    this works in the fact that it shows just the files that i want in a listbox, but i cannot get the "double-click to open" to work.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    the double click will be part of the code behind the listbox. e.g. -
    Code:
    application.followhyperlink "drive:\folder\folder\" & me.listbox

  5. #5
    jimmyp75 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Posts
    3
    My section of code looks liks this... it is SOOO close and it is got to be something so simple that i am overlooking.
    (ignore the remarked-out lines... just stuff i have been trying )


    Private Sub lstFileList_DblClick(Cancel As Integer)
    filepath = "S:\GEIT\ShipTicketsandOrderConf\"
    'Application.FollowHyperlink "filepath\ & " * " & [JWJ_PO_Num] & " * " & FileName"
    'Application.FollowHyperlink "S:\GEIT\ShipTicketsandOrderConf\" & Me.ListBox
    Application.FollowHyperlink "S:\GEIT\ShipTicketsandOrderConf\" & Me.lstFileList

    End Sub

    when i double click on the Path in the Listbox, it goes into Debug mode and highlights the last line (not END SUB)

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    is your filename in the listbox the complete name? what's the message say? are you missing a backslash? It's probably any of the above reasons.

    if your box says:
    Code:
    myfile
    and not:
    Code:
    myfile.extension
    then obviously VBA sees:
    Code:
    application.followhyperlink "path:\myfile"
    which it can't execute. Right?

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

Similar Threads

  1. Replies: 1
    Last Post: 02-21-2011, 09:55 PM
  2. Replies: 1
    Last Post: 02-12-2011, 09:06 PM
  3. Enter a folder name and open that folder
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 09-05-2010, 04:39 PM
  4. Subform with multi filters
    By Aragon.2009 in forum Forms
    Replies: 0
    Last Post: 08-27-2010, 03:01 PM
  5. Creating Filters on a Form
    By Nixx1401 in forum Access
    Replies: 4
    Last Post: 02-27-2010, 05:32 AM

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