Searching a file

G

Guest

Hi,
Im using Ms Access97 (OS := Win-XP), Im trying to use 'FileSearch' function
in a form to search a specific file in all the network drives.
There is no compilation error but at the run time Im having an error like
this :

Run-Time error '-2144010224 (80350010)' :
Method 'Execute' of object 'FileSearch' failed

The code Im using is :

Private Sub cmdProcess_Click()

Dim strFileName As String, i As Integer
s = Me![txtLookInPath]
strFileName = "xyz.mdb"

If IsNull(Me![txtLookInPath]) Or Me![txtLookInPath].Value = "" Then
MsgBox "No folder selected, select folder....", vbCritical
DoCmd.GoToControl "cmdSelectFolder"
Else
With Application.FileSearch
.FileName = strFileName
.LookIn = s
.SearchSubFolders = True
If .Execute() > 0 Then
For i = 1 To 10 '.FoundFiles.Count
For Each vItem In .FoundFiles
Debug.Print vItem
Me![txtCurrLocation].Value = vItem
' ReadFileData
Next vItem
Next i
Else
MsgBox "File not found in : " & s, vbInformation
End If
End With
End If
End Sub

Could you please help me out to solve this problem. Send me the solved
coding in your return mail at (e-mail address removed) OR
(e-mail address removed).
Thanks 'n' regards.
Koushik Chakraborty.
 
D

Douglas J Steele

There is no FileSearch method in Access 97. You must have a reference set to
some other object that does have a FileSearch method, which is why it
doesn't raise a compile error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Koushik from Tele Atlas said:
Hi,
Im using Ms Access97 (OS := Win-XP), Im trying to use 'FileSearch' function
in a form to search a specific file in all the network drives.
There is no compilation error but at the run time Im having an error like
this :

Run-Time error '-2144010224 (80350010)' :
Method 'Execute' of object 'FileSearch' failed

The code Im using is :

Private Sub cmdProcess_Click()

Dim strFileName As String, i As Integer
s = Me![txtLookInPath]
strFileName = "xyz.mdb"

If IsNull(Me![txtLookInPath]) Or Me![txtLookInPath].Value = "" Then
MsgBox "No folder selected, select folder....", vbCritical
DoCmd.GoToControl "cmdSelectFolder"
Else
With Application.FileSearch
.FileName = strFileName
.LookIn = s
.SearchSubFolders = True
If .Execute() > 0 Then
For i = 1 To 10 '.FoundFiles.Count
For Each vItem In .FoundFiles
Debug.Print vItem
Me![txtCurrLocation].Value = vItem
' ReadFileData
Next vItem
Next i
Else
MsgBox "File not found in : " & s, vbInformation
End If
End With
End If
End Sub

Could you please help me out to solve this problem. Send me the solved
coding in your return mail at (e-mail address removed) OR
(e-mail address removed).

Sorry, that's not how newsgroups work. If you post a question to the
newsgroup, you come back to the newsgroup to get your answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top