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? -
stFileNumber = [FILE_NO]
-
stPathName = "O:\" & [FILE_NO]
-
stFileName = [FILE_NO] & ".rtf"
-
stPFName = stPathName & "\" & stFileName
-
-
If Dir$(stPathName, vbDirectory) <> "" Then ' Does Path Already Exist?
-
MsgBox ("The directory " & stPathName & " Already exits")
-
GoTo Exit_Create_Order_File_Structure_Click
-
Else
-
MkDir Path:=(stPathName) ' Create Directory Structure
-
End If
-
-
Application.FileSearch.RefreshScopes ' Refresh Directory Structure
-
' Create Report File
-
DoCmd.OutputTo acOutputReport, "File Creation", acFormatRTF, stPFName
-
MsgBox ("The " & stPathName & " folder and the file " & stFileName & " have been created")
-
22 5648
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? -
stFileNumber = [FILE_NO]
-
stPathName = "O:\" & [FILE_NO]
-
stFileName = [FILE_NO] & ".rtf"
-
stPFName = stPathName & "\" & stFileName
-
-
If Dir$(stPathName, vbDirectory) <> "" Then ' Does Path Already Exist?
-
MsgBox ("The directory " & stPathName & " Already exits")
-
GoTo Exit_Create_Order_File_Structure_Click
-
Else
-
MkDir Path:=(stPathName) ' Create Directory Structure
-
End If
-
-
Application.FileSearch.RefreshScopes ' Refresh Directory Structure
-
' Create Report File
-
DoCmd.OutputTo acOutputReport, "File Creation", acFormatRTF, stPFName
-
MsgBox ("The " & stPathName & " folder and the file " & stFileName & " have been created")
-
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.
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!
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.
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.
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?
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?
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.
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.
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.
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.
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?
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.
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
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.
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!
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.
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.
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.
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.
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.
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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....
|
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...
|
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...
|
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...
|
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...
|
by: Anthony97 |
last post by:
I get the following error message
Run-time error '2455' you entered invalid reference to the property FileSearch
...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |