.Filesearch Problem

B

Bubar

I've been using a very simple .filesearch routine for several years with
Access 2000 in a Windows 2000 professional environment.

I'm attempting to convert to Access 2002 in a Windows XP Professional
environment.

Here's the code from a small test form that displays my search results:

Dim Mysearch as Filesearch

Private Sub But_Click_Click()
Set Mysearch = Application.FileSearch

With Mysearch
.LookIn = "c:\PictureImportArea"
.FileName = "DSCN*"
Me.XBOX2 = .Execute
Me.XBOX1 = .FoundFiles.COUNT
End With

End Sub

Private Sub Form_Open(Cancel As Integer)
Me.XBOX1 = ""
Me.XBOX2 = ""
End Sub

It doesn't get much simpler than this, but it's been driving me absolutely
crazy.

The Directory is correct, the files I'm looking for (.jpg) are present, and
all of the
Access references are present.

I've tried a hundred variations and can't count a single file. I've tried
using '%' instead of '*' for wild cards (somewhere I read this might change),
many of the new syntax options, exact file names, and you name it.

This is really killing my self confidence. Someone please help. I'm sure
that I'm missing something really simple. Thanks!
 
B

Bubar

So far I've Tried --
.NewSearch

.LookIn = "C:\PictureArea" (Hard Coded)
.LookIn = "<String Variable>"

.FileName = "DSCN*.*"
.FileName = "*.JPG"
.FileName = "DSCN0029.JPG"

.MatchAllWordForms = True
.MatchTextExactly = True

.SearchFolders = True
.SearchSubFolders = True

.TextorProperty = "DSCN*"
.TextorProperty = "*JPG"
.TextorProperty = "DSCN00029.JPG"

I've tried combinations of all of the above (all beginning with .Newsearch)
with the same result --
.Execute = 0 .FilesFound = 0 .Execute() = 0

Either I'm not using the right combination of options or have them in the
wrong
sequence.

I'm starting to believe there is an error (or possibly corruption) in
the Microsoft Office 10.0 Object Library (installed with Office XP
Professional
version 2002, SP1).

Thanks for your response. Any other suggestions will be greatly appreciated!
 
T

TC

Cripes!

Does .LookIn need a trailing slash? .LookIn = "C:\PictureArea\"

Try using Dir$() to find one of the files that you know to be present.
If /that/ doesn't work, it would suggest that the problem is something
to do with the files themselves - not the FileSearch method as such.

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
B

Bubar

TC

Great suggestions! I won't be able to try them for a few days but you
can bet
I will. It's great to have someone to talk with about this.

Although I've only had a few hours experience with the new 2002 version, I
noticed that the .Filesearch seemed to be changed to be a little more
"MicroSoftish"
(looking specifically for Office related file types). The thought crossed
my mind that ".jpg" files (the file type I'm working with) aren't really a
Microsoft convention.

Consequently, I'm going to try a variety of file types and your
suggestions the next
time I have a go at it.

Thanks for your time and trouble. I sincerely appreciate your ideas.

Wayne Buehrer
 
B

Bubar

Your suggestions were great and activated a few gray cells that spurred me on.
Unfortunately the results were the same, so here are my latest adventures:

1. Moved some '.doc' and '.xls' files to the directory I'm searching. (to
see if it would work with native Microsoft files.

2. Un-installed and re-installed Office XP Professional.

3. Created a new '.mdb' file with a new program just in case there was some
corruption.

4. Tried the commands without the 'with' / 'end with' (e.g.
MySearch.FileSearch,
MySearch.lookin, MySearch.execute, etc.)

5. Moved the files to be searched to a new directory.

6. Changed the Case on the directory and file names to make sure they are
all
in 'Upper Case'. (just for the heck of it)

To-date -- everything has failed - my results are still '0'. Can't find a
thing!

I wish there was a way to contact Microsoft with having to pay $245.
 

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