Solved

Help converting application.filesearch

Posted on 2007-11-27
3
1,417 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 85

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

632 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