Solved

Help converting application.filesearch

Posted on 2007-11-27
3
1,416 Views
Last Modified: 2013-12-05
I had posted this question before, but just found out the solution didn't work.  Here's another attempt...

I am using Access 2007 adp to SQL 2005.  During the conversion, we've discovered that the following code no longer works:
       
'                                    Set FS = Application.FileSearch
'                                    With FS
'                                        F = "S:\MattersClosingDocuments\" & rsImp![CLIENT NUMBER] & rsImp![SubNumber] & rsImp![MATTER NUMBER] & rsImp![Series] & "\EmailAttachmentPost\"
'
'                                       'frmDocumentAttachment_notify
'                                       ChDir F
'
'                                        .LookIn = F
'                                        .FileName = fname
'                                        If .Execute() > 0 Then
'                                            'MsgBox "There were " & .FoundFiles.count & _
'                                                " file(s) found."
'
'                                           fname = Left(fname, Len(fname) - 4) & "_" & z & Right(fname, 4)
'
'                                        Else
'                                            'MsgBox "There were no files found."
'                                        End If
'                                    End With

It was recommended I use this code to replace it, but it does not return the expected results:
Dim iCnt As Integer
                                        Dim tempfname As String
                                        F = "S:\MattersClosingDocuments\" & rsImp![CLIENT NUMBER] & rsImp![SubNumber] & rsImp![MATTER NUMBER] & rsImp![Series] & "\EmailAttachmentPost\"
                                        'f is the path
                                        iCnt = 1
                                        tempfname = Dir(F & "\*.*")
                                        Do While tempfname <> ""
                                            fname = tempfname
                                             fname = Left(fname, Len(fname) - 4) & "_" & z & Right(fname, 4)
                                            iCnt = iCnt + 1
                                            fname = Dir()  '' Get next file
                                        Loop
jumpout:
etc...

Could someone provide a different piece of code to replace the application.filesearch?

Thanks!                                                                        
0
Comment
Question by:dleads
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 20377922
What exactly are you trying to accomplish with the FileSearch? Or, better yet, what are you trying to do with the code? It appears you're trying to loop through files and do something... can you explain exactly what you're trying to do?

0
 

Author Comment

by:dleads
ID: 20378055
I've just taken over this code...

What it appears to be is looking for the names of files in a folder and counting them.
0
 

Author Closing Comment

by:dleads
ID: 31411283
I'm closing the message due to lack of time to address it.  I appreciate your attempt to help and therefore am awarding the points.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question