473,549 Members | 2,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemObjec t Problem - "fso is nothing"

Stang02GT
1,208 Recognized Expert Top Contributor
Hey guys,

I was asked to help solve an issue another developer was having and I personally don't know much about it so I am turning to you guys for a little help/guidance.

My co-worker has created an ASP page that is trying to pull the latest report from the network. And the ASP is failing when it tries to create the FSO to scan the files. A virtual directory has not been created yet so he is pointing directly to the network path.

The page is using the FSO and excel, and when i click on one of the Excel report links i get "fso is nothing"


Here is the code:

Expand|Select|Wrap|Line Numbers
  1.  Function GetLatestReport(path, rptName)
  2.         Dim fso
  3.         Dim rptFolder
  4.         Dim rptDate
  5.         Dim fiTemp
  6.         Dim fi
  7.         Dim report
  8.         Dim x
  9.         Dim msg 
  10.  
  11.     On error Resume Next
  12.  
  13.         msg = ""
  14.  
  15.         Set fso = CreateObject("Scripting.FileSystemObject")
  16.  
  17.         Window.status = "Retrieving " & rptName
  18.  
  19.         rptDate = CDate("1/1/1900")
  20.  
  21.         Set rptFolder = fso.GetFolder(path)
  22.  
  23.         If rptFolder Is Nothing Then
  24.             msg = msg & "Could not find path to " & rptName & chr(13)
  25.         Else
  26.             For Each fi in rptFolder.Files
  27.                 msgbox fi.Name
  28.                 If err.number <> 0 Then
  29.                     msg = msg & err.Description & chr(13)
  30.                     err.Clear 
  31.                 Else
  32.                     If InStr(1, Ucase(fi.Name), UCase(rptName)) > 0 Then
  33.                         If fi.DateCreated > rptDate Then
  34.                             Set fiTemp = fi
  35.                             rptDate = fiTemp.DateCreated
  36.                         End If
  37.                     ElseIf fi.Name > rptName Then
  38.                         Exit For               
  39.                     End If
  40.                 End If
  41.             Next
  42.  
  43.             report = fiTemp.Path
  44.         End If
  45.  
  46.         If msg <> "" Then
  47.             Msgbox "The following errors occurred during the page load:" & chr(13) & chr(13) &   msg
  48.         End If
  49.  
  50.         Set fso = Nothing
  51.  
  52.         GetLatestReport = report
  53.     End Function
Apr 15 '08 #1
4 1827
DrBunchman
979 Recognized Expert Contributor
Hi Stang02GT,

Which line does it fail on if you comment out the "On error Resume Next" line and then run it again?

Also, the FSO can have problems using network paths (e.g. <server><share> <filename>). Is the folder you're trying to reference remote or local?

Dr B
Apr 15 '08 #2
Stang02GT
1,208 Recognized Expert Top Contributor
I think the issue lies with your second statement. The folder is remote, its on a server.
Apr 15 '08 #3
DrBunchman
979 Recognized Expert Contributor
Can you try testing it on a local path to see if it works? Let me know how it goes.

Dr B
Apr 16 '08 #4
Stang02GT
1,208 Recognized Expert Top Contributor
Can you try testing it on a local path to see if it works? Let me know how it goes.

Dr B
I will do that. Thank you very much for you help!
Apr 16 '08 #5

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

Similar topics

2
4667
by: Benny Alexander | last post by:
Hi, I bought a ASP portal script, aspportal.net, But It gives a problem from a line, Set folderpath = fso.getfolder(thepath) The error is, Error Type: Microsoft VBScript runtime (0x800A01B6) Object doesn't support this property or method: 'getfolder' /aspportal/themes/themes.asp, line 37
5
16763
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true and no files are deleted in the folder. The peculiarity of this issue is that the files/subfolders cannot be seen through the windows explorer...
13
25292
by: John A Grandy | last post by:
apparently references of type Date can not assume the value Nothing, because the following code fails: Dim d As Date .......other code...... If d Is Nothing Then End If so then what is the equivalent to Nothing for a reference of type Date ?
10
3069
by: Larry Bird | last post by:
I'm trying to check for the presents of null values or null value not being present. My sample code below: If EmailAddresses Is Nothing Then SendMailMessage(EmailAddresses, AlertTitle, ViolationBody) End If
4
4508
by: Avlan | last post by:
Hi, I'm pretty new with ASP-coding, but I got a simple login working. I let the user enter a username and password and through a SQL-statement I check if there is a corresponding password in the database (Yes I know, not very good security but for the moment it's enough). Problem is that when I enter a false user/password, I want the code...
2
11902
by: Oenone | last post by:
In our applications, we use the special value of DateTime.MinValue to represent "null dates" throughout all our code. We recently ran into an issue where we wanted an optional date parameter for a procedure. We weren't able to declare it with DateTime.MinValue as its default value, as MinValue is a read-only property rather than a constant. To...
0
1213
by: cfriedalek | last post by:
I'm writing a python script using win32com to call a 3rd party program via its VBS based API. In VBS a query to get some plot data goes like this: Plot.QueryBegin datacode, Nothing What is this in python? Plot.QueryBegin(datacode, None) does not work. I get a type mismatch
0
1137
by: Larry Bud | last post by:
Using XML serializer, if an XML field is missing, then the value in the object is Nothing. Is there a slick way of converting a "Nothing" to an empty string without doing is if x is nothing then...
0
7548
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7472
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7986
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6074
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5391
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3499
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.