![]() |
|
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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" |
|
#3
|
|||
|
|||
|
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
|
||||
|
||||
|
Quote:
__________________
(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" |
|
| Bookmarks |
| Tags |
| execute, filesearch |
| Thread Tools | |
| Display Modes | |
|
|
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 |