Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help converting application.filesearch

Posted on 2007-11-27
3
Medium Priority
?
1,420 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 1500 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

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

719 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