Results 1 to 4 of 4
  1. #1
    tdalber is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2009
    Posts
    6

    FileSearch object not finding files

    I'm using WinXP and Access2003 and I'm trying to fill in a list box with a list of PDF files so the user can open relevent drawings, maps, etc. of the facility.

    My code is simple (right out of the help files). [LastSlash is a function that returns the filename once found.]

    Private Sub FillList()
    Dim fs As Variant
    Dim i As Long
    Dim FileList As String
    Dim WholePath As String

    FileList = ""
    Set fs = Application.FileSearch
    DoCmd.Hourglass (True)

    Set EditSet = CurrentDb.OpenRecordset("SELECT tblAdmin.AdminID, tblAdmin.AdminPDFPath FROM tblAdmin " _
    & "WHERE (((tblAdmin.AdminID)='X'));", dbOpenDynaset, dbSeeChanges)
    WholePath = EditSet("AdminPDFPath") & "\" & Me!ztxtSiteID.Value & "\"
    With fs
    .NewSearch
    .LookIn = WholePath
    .FileName = "*.pdf"
    If .Execute(SortBy:=msoSortByFileName, _
    SortOrder:=msoSortOrderAscending) > 0 Then
    For i = 1 To .FoundFiles.Count
    FileList = FileList & LastSlash(.FoundFiles(i)) & ";"
    Next i
    End If
    Me!lstImages.RowSource = FileList
    Me!lstImages.Requery
    End With
    DoCmd.Hourglass (False)
    End If



    Set EditSet = Nothing
    End Sub

    The problem is, that if WholePath points to my local drive, as in:
    WholePath = "C:\Documents and Settings\talber\Desktop\Current Projects\SW-MSGP\PDF\GUERDO5556FEDER"
    or
    WholePath = "C:\MSGP\PDF\GUERDO5556FEDER"
    it doesn't work all the time (it will occasionally if you manually run it through the code a few times). The execute statement just doesn't find any files, even though they exist in that directory according to explorer.

    However, if WholePath points to a network drive, as in:
    WholePath = "I:\USERS\Pretreatment\FOG Database\PDF\GUERDO5556FEDER"
    or
    WholePath = "I:\USERS\Pretreatment\MSGP\PDF\GUERDO5556FEDER"
    it works just peachy.

    I have beat my head against this all day, now, and am fed up.

    Any ideas?

    Thanks,
    Terry

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you move the folder closer to the root do you still have a problem? There used to be a 64 character limit to a path in DOS. I wonder if the current limit is large enough?

  3. #3
    tdalber is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2009
    Posts
    6
    Thanks, RuralGuy, for responding.

    That's what I tried to do with:
    WholePath = "C:\MSGP\PDF\GUERDO5556FEDER"
    but it didn't seem to matter. I thought maybe either length or spaces with the whole C:\Documents and Settings\ path might have been the issue, but my network paths are longer AND one of them has a space, and it works.

    I can't get much shorter, unless I rewrite things to not use the Facility ID code.

    Terry

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by tdalber View Post
    Thanks, RuralGuy, for responding.

    That's what I tried to do with:
    WholePath = "C:\MSGP\PDF\GUERDO5556FEDER"
    but it didn't seem to matter. I thought maybe either length or spaces with the whole C:\Documents and Settings\ path might have been the issue, but my network paths are longer AND one of them has a space, and it works.

    I can't get much shorter, unless I rewrite things to not use the Facility ID code.

    Terry
    I think it has to be something else then. Don't know what yet.

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

Similar Threads

  1. Importing multiple files at once
    By NoiCe in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2009, 10:10 AM
  2. Importing Xls and CSV files into MS Access
    By Jeff in forum Import/Export Data
    Replies: 1
    Last Post: 02-17-2009, 11:56 PM
  3. Finding data that doesn't match
    By dlhayes in forum Queries
    Replies: 1
    Last Post: 11-11-2006, 08:14 PM
  4. Replies: 1
    Last Post: 07-09-2006, 09:23 AM
  5. Finding data between two date for any year
    By gemini2 in forum Access
    Replies: 4
    Last Post: 04-05-2006, 06:20 AM

Tags for this Thread

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