473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error on Application.FileSearch.RefreshScopes

tdw
206 100+
We just added a new login name in our server for a girl named Courtney. She is using a computer that I used to use. The following code in our Orders Database has alway worked fine, but when she is logged in to that particular computer she gets an error on the Application.FileSearch.RefreshScopes command. It says something to the effect that it "failed".

When I log in to that computer, it works. When she logs in to any other computer, it works. It only doesn't work when she is logged in to that particular computer.

Our database is not set up for user logins, permissions, etc so we don't think anything is wrong with the code or the database. Could there be a setting on the computer that is wrong when she is logged into it that is blocking the Application.FileSearch.RefreshScopes line?

Expand|Select|Wrap|Line Numbers
  1. stFileNumber = [FILE_NO]
  2.     stPathName = "O:\" & [FILE_NO]
  3.     stFileName = [FILE_NO] & ".rtf"
  4.     stPFName = stPathName & "\" & stFileName
  5.  
  6.     If Dir$(stPathName, vbDirectory) <> "" Then  ' Does Path Already Exist?
  7.         MsgBox ("The directory " & stPathName & " Already exits")
  8.         GoTo Exit_Create_Order_File_Structure_Click
  9.     Else
  10.         MkDir Path:=(stPathName)   '  Create Directory Structure
  11.     End If
  12.  
  13.     Application.FileSearch.RefreshScopes  '  Refresh Directory Structure
  14. '   Create Report File
  15.     DoCmd.OutputTo acOutputReport, "File Creation", acFormatRTF, stPFName
  16.     MsgBox ("The " & stPathName & " folder and the file " & stFileName & " have been created")
  17.  
May 21 '07 #1
22 5648
ADezii
8,834 Expert 8TB
We just added a new login name in our server for a girl named Courtney. She is using a computer that I used to use. The following code in our Orders Database has alway worked fine, but when she is logged in to that particular computer she gets an error on the Application.FileSearch.RefreshScopes command. It says something to the effect that it "failed".

When I log in to that computer, it works. When she logs in to any other computer, it works. It only doesn't work when she is logged in to that particular computer.

Our database is not set up for user logins, permissions, etc so we don't think anything is wrong with the code or the database. Could there be a setting on the computer that is wrong when she is logged into it that is blocking the Application.FileSearch.RefreshScopes line?

Expand|Select|Wrap|Line Numbers
  1. stFileNumber = [FILE_NO]
  2.     stPathName = "O:\" & [FILE_NO]
  3.     stFileName = [FILE_NO] & ".rtf"
  4.     stPFName = stPathName & "\" & stFileName
  5.  
  6.     If Dir$(stPathName, vbDirectory) <> "" Then  ' Does Path Already Exist?
  7.         MsgBox ("The directory " & stPathName & " Already exits")
  8.         GoTo Exit_Create_Order_File_Structure_Click
  9.     Else
  10.         MkDir Path:=(stPathName)   '  Create Directory Structure
  11.     End If
  12.  
  13.     Application.FileSearch.RefreshScopes  '  Refresh Directory Structure
  14. '   Create Report File
  15.     DoCmd.OutputTo acOutputReport, "File Creation", acFormatRTF, stPFName
  16.     MsgBox ("The " & stPathName & " folder and the file " & stFileName & " have been created")
  17.  
She may not have Access Privileges to the stPathName Directory Structure. Make sure she or her assigned 'Group' has 'Full Rights' to that Directory Structure.
May 22 '07 #2
tdw
206 100+
She may not have Access Privileges to the stPathName Directory Structure. Make sure she or her assigned 'Group' has 'Full Rights' to that Directory Structure.
I've got somebody looking into that. What seemed strange to us was that the code that creates the folder on the O: drive works. The folder shows up. But then when it is supposed "...RefreshScopes" (to export the .rtf file), it doesn't work. Just from that computer, and just when she's logged in. Also, we are all a part of the same group, and she supposedly has full rights (it works fine under her login on different computers). If it's not a coding problem, then I suppose it becomes a problem for another forum? Thanks as always!
May 22 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
In an effort to debug. Have a look at this method on TSDN to check the directory structure at all stages of this code.

http://msdn2.microsoft.com/en-us/library/aa171279(office.11).aspx

This should tell you if there are problems with the permissions.
May 22 '07 #4
tdw
206 100+
In an effort to debug. Have a look at this method on TSDN to check the directory structure at all stages of this code.

http://msdn2.microsoft.com/en-us/library/aa171279(office.11).aspx

This should tell you if there are problems with the permissions.
Ok, good test! Well that narrowed it down. It is not a problem with the database, not a problem with her access to our server. The test creates a new folder on the hard drive (C:) and then tries to searchscopes. The Error said "Runtime error 2147467259 (80004005) Method 'Searchscopes' of object 'FileSearch' failed. Some kind of setting unique to her profile on that computer when she logs in? We're puzzled about what setting that might be though.
May 23 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
Ok, good test! Well that narrowed it down. It is not a problem with the database, not a problem with her access to our server. The test creates a new folder on the hard drive (C:) and then tries to searchscopes. The Error said "Runtime error 2147467259 (80004005) Method 'Searchscopes' of object 'FileSearch' failed. Some kind of setting unique to her profile on that computer when she logs in? We're puzzled about what setting that might be though.
In the VBA Editor window. Go to Tools - References. See if any of the libraries are marked as missing. If not make sure the list corresponds the list on your Profile.
May 23 '07 #6
tdw
206 100+
In the VBA Editor window. Go to Tools - References. See if any of the libraries are marked as missing. If not make sure the list corresponds the list on your Profile.
There are many libraries not checked, but:
Her profile has the following libraries checked:
ActiveX Data Objects 2.1 library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Access 11.0 Object Library
Visual Basic for Applications.

Mine has the same list checked, except for instead of "Visual Basic for Applications" mine says "Microsoft Visual Basic for Applications Extensibility 5.3"

I looked in her list of unchecked boxes and she has the Extensibility 5.3 one in there. I tried checking it and retried running the test, and it didn't fix it.

Could it be something else, like a firewall setting or other security setting?
May 23 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
There are many libraries not checked, but:
Her profile has the following libraries checked:
ActiveX Data Objects 2.1 library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Access 11.0 Object Library
Visual Basic for Applications.

Mine has the same list checked, except for instead of "Visual Basic for Applications" mine says "Microsoft Visual Basic for Applications Extensibility 5.3"

I looked in her list of unchecked boxes and she has the Extensibility 5.3 one in there. I tried checking it and retried running the test, and it didn't fix it.

Could it be something else, like a firewall setting or other security setting?
Its quite possible but that is getting outside my area of expertise.

Try moving the "Microsoft Visual Basic for Applications Extensibility 5.3" library further up the list. "Visual Basic for Applications" should be at the top of the list. I'm very surprised your system doesn't have it checked. Are you using different versions of Access?
May 23 '07 #8
tdw
206 100+
Its quite possible but that is getting outside my area of expertise.

Try moving the "Microsoft Visual Basic for Applications Extensibility 5.3" library further up the list. "Visual Basic for Applications" should be at the top of the list. I'm very surprised your system doesn't have it checked. Are you using different versions of Access?
I'm sorry, I took a second look at mine and I do have it check. However, I do not have ActiveX Data Objects 2.1 Library on mine at all. I don't know how I misread it the first time unless it changed after closing the file and reopening it.

I tried moving the Extensibility one on her list up to position #2. No fix.
May 23 '07 #9
tdw
206 100+
Oh, forgot to answer one question: We are both using Access 2003.
Interestingly, there is almost nothing to be found on this through googling. The runtime error code comes up but in so many diverse situations that I haven't yet found one that seems to apply to the RefreshScopes and SearchScopes methods.
May 23 '07 #10
ADezii
8,834 Expert 8TB
There are many libraries not checked, but:
Her profile has the following libraries checked:
ActiveX Data Objects 2.1 library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Access 11.0 Object Library
Visual Basic for Applications.

Mine has the same list checked, except for instead of "Visual Basic for Applications" mine says "Microsoft Visual Basic for Applications Extensibility 5.3"

I looked in her list of unchecked boxes and she has the Extensibility 5.3 one in there. I tried checking it and retried running the test, and it didn't fix it.

Could it be something else, like a firewall setting or other security setting?
I see no Reference to the Microsoft Office XX.X Object Library of which the FileSearch Object, I'm pretty sure, is a Component of. It would also explain the Method of Object Failed Error. The problem does not seem to be with a missing Reference, you simply do not have it.
May 24 '07 #11
MMcCarthy
14,534 Expert Mod 8TB
I see no Reference to the Microsoft Office XX.X Object Library of which the FileSearch Object, I'm pretty sure, is a Component of. It would also explain the Method of Object Failed Error. The problem does not seem to be with a missing Reference, you simply do not have it.
Strange that it is working on his profile without that reference. I'm sure you're right though.
May 24 '07 #12
tdw
206 100+
Strange that it is working on his profile without that reference. I'm sure you're right though.
So is there any particular reason to not have all of the reference libraries turned on? There is an unchecked item called Microsoft Office 11.0 Object Library, should I try turning it on, or is there some reason to NOT do that?
When there are so many items not checked in that list, does it mean that they are all present, but not turned on?
May 24 '07 #13
tdw
206 100+
Does it even really need refreshscopes? The code is creating a new folder, then exporting a report to it as a .rtf file. Shouldn't it work without refreshing the folder list? It's not like we are trying to display the list of available folders.
May 24 '07 #14
MMcCarthy
14,534 Expert Mod 8TB
So is there any particular reason to not have all of the reference libraries turned on? There is an unchecked item called Microsoft Office 11.0 Object Library, should I try turning it on, or is there some reason to NOT do that?
When there are so many items not checked in that list, does it mean that they are all present, but not turned on?
I wouldn't try turning them all on. Apart from anything else some of them conflict with each other. However, there is no reason not to tick the Microsoft Office 11.0 Object Library and see if that resolves your problem.

Mary
May 24 '07 #15
MMcCarthy
14,534 Expert Mod 8TB
Does it even really need refreshscopes? The code is creating a new folder, then exporting a report to it as a .rtf file. Shouldn't it work without refreshing the folder list? It's not like we are trying to display the list of available folders.
Try commenting out the line of code and see if there are any problems.
May 24 '07 #16
tdw
206 100+
Try commenting out the line of code and see if there are any problems.
Thank you for both suggestions, I will try them at my next opportunity and get back to you if neither works. Thanks again!
May 24 '07 #17
MMcCarthy
14,534 Expert Mod 8TB
Thank you for both suggestions, I will try them at my next opportunity and get back to you if neither works. Thanks again!
No problem, you're welcome.
May 24 '07 #18
ADezii
8,834 Expert 8TB
Does it even really need refreshscopes? The code is creating a new folder, then exporting a report to it as a .rtf file. Shouldn't it work without refreshing the folder list? It's not like we are trying to display the list of available folders.
You are probably correct. Line #13 utilizing RefreshScopes as it aspplies to the FileSearch Object would require a Reference to the Microsoft Office XX.X Object Library and I don't think that the Directory Structure needs to be refreshed. Referencing an entire Type Library for a single line of code that may not even be necessary does not make any sense. Take Mary's suggestion by commenting out the line, and I bet you it will work. Get back to us on the results.
May 24 '07 #19
tdw
206 100+
You are probably correct. Line #13 utilizing RefreshScopes as it aspplies to the FileSearch Object would require a Reference to the Microsoft Office XX.X Object Library and I don't think that the Directory Structure needs to be refreshed. Referencing an entire Type Library for a single line of code that may not even be necessary does not make any sense. Take Mary's suggestion by commenting out the line, and I bet you it will work. Get back to us on the results.
It works fine on my computer without that line. The next step will be to test it on Courtney's login to see if that solved the problem. I'll let you know how that goes when we do that later this morning.
May 25 '07 #20
MMcCarthy
14,534 Expert Mod 8TB
It works fine on my computer without that line. The next step will be to test it on Courtney's login to see if that solved the problem. I'll let you know how that goes when we do that later this morning.
Sounds good, here's hoping.
May 25 '07 #21
tdw
206 100+
Sounds good, here's hoping.
It's working beautifully. Thanks a lot! I wonder why the original programmer bothered to put that line in there. It doesn't appear to need it.
May 25 '07 #22
MMcCarthy
14,534 Expert Mod 8TB
It's working beautifully. Thanks a lot! I wonder why the original programmer bothered to put that line in there. It doesn't appear to need it.
Trying to interpret another programmers reasons for doing anything is a good way to fry your brain :)

Glad you got it working.

Mary
May 25 '07 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wilson Tan | last post by:
Has anybody encountered any problem with the Execute method or FilesFound property of the FileSearch object in Access 2002? I have this short routine that searches for a specific file that I'm...
4
by: dhcomcast | last post by:
We're starting to use Oracle for the back-end instead of a separate Access .mdb file for the data and everything as gone surprisingly well so far. We are learning Oracle as we go; Yikes! But we...
3
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
19
by: Alan Carpenter | last post by:
Access 8 on Win98 and WinXP I'm having trouble with wildcards in the .Filename property of the FileSearch Object giving different results on win98 and XP. I've been successfully using...
5
Lokean
by: Lokean | last post by:
At the top of my module I have Imports Microsoft.Office.Core Imports VBA Public Function rpu_process_files(Optional ByVal sFolderString As String = "", _ Optional ByVal sSearchString...
0
by: Mihov | last post by:
Hi Everybody, My name is Miho. I have developed number of macros using Visual Basic for Excel. Many of them use FileSearch which worked perfectly before Excel 2007. With Excel 2007 this is no...
3
by: MLH | last post by:
With Application.FileSearch .NewSearch .LookIn = "C:\My Documents" .SearchSubFolders = True .FileName = "Run" .MatchTextExactly = True .FileType = msoFileTypeAllFiles End With My code pukes...
10
by: Anthony97 | last post by:
I get the following error message Run-time error '2455' you entered invalid reference to the property FileSearch ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.