Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-13-2009, 12:46 PM
tdalber tdalber is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jan 2009
Posts: 6
tdalber is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 05-14-2009, 07:54 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

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?
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
  #3  
Old 05-14-2009, 08:04 AM
tdalber tdalber is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jan 2009
Posts: 6
tdalber is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 05-14-2009, 08:16 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

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.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Tags
execute, filesearch

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing multiple files at once NoiCe Import/Export Data 1 04-01-2009 08:10 AM
Importing Xls and CSV files into MS Access Jeff Import/Export Data 1 02-17-2009 08:56 PM
Finding data that doesn't match dlhayes Queries 1 11-11-2006 05:14 PM
How many files/pics can be attached to database? Suzan Access 1 07-09-2006 07:23 AM
Finding data between two date for any year gemini2 Access 4 04-05-2006 04:20 AM


All times are GMT -8. The time now is 02:51 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.