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:\MattersClosingDocument
s\" & rsImp![CLIENT NUMBER] & rsImp![SubNumber] & rsImp![MATTER NUMBER] & rsImp![Series] & "\EmailAttachmentPost\"
'
' 'frmDocumentAttachment_not
ify
' 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:\MattersClosingDocument
s\" & 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!
Start Free Trial