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: - Function GetLatestReport(path, rptName)
-
Dim fso
-
Dim rptFolder
-
Dim rptDate
-
Dim fiTemp
-
Dim fi
-
Dim report
-
Dim x
-
Dim msg
-
-
On error Resume Next
-
-
msg = ""
-
-
Set fso = CreateObject("Scripting.FileSystemObject")
-
-
Window.status = "Retrieving " & rptName
-
-
rptDate = CDate("1/1/1900")
-
-
Set rptFolder = fso.GetFolder(path)
-
-
If rptFolder Is Nothing Then
-
msg = msg & "Could not find path to " & rptName & chr(13)
-
Else
-
For Each fi in rptFolder.Files
-
msgbox fi.Name
-
If err.number <> 0 Then
-
msg = msg & err.Description & chr(13)
-
err.Clear
-
Else
-
If InStr(1, Ucase(fi.Name), UCase(rptName)) > 0 Then
-
If fi.DateCreated > rptDate Then
-
Set fiTemp = fi
-
rptDate = fiTemp.DateCreated
-
End If
-
ElseIf fi.Name > rptName Then
-
Exit For
-
End If
-
End If
-
Next
-
-
report = fiTemp.Path
-
End If
-
-
If msg <> "" Then
-
Msgbox "The following errors occurred during the page load:" & chr(13) & chr(13) & msg
-
End If
-
-
Set fso = Nothing
-
-
GetLatestReport = report
-
End Function
4 1827
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
Stang02GT 1,208
Recognized Expert Top Contributor
I think the issue lies with your second statement. The folder is remote, its on a server.
Can you try testing it on a local path to see if it works? Let me know how it goes.
Dr B
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!
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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...
|
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 ?
|
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
|
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...
| |
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...
|
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
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
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...
| |