Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

txt file on network drive

Status
Not open for further replies.

NurseIS

MIS
Sep 3, 2001
46
0
0
US
Have a small form which can write to a local file. I'd like to place the html form on a share drive and have the appendable txt file there also. Using client PC only; no web server.

I've adjusted the file path part of the script but it does not write to the file which is also in the same folder as the html file on the share drive. Will vbs write to files on the network or am I spinning my wheels?

I've also tried with the UNC path (abbreviated here) -- \\...fpc1\share\....

Ex:
Set fso=CreateObject("Scripting.FileSystemObject")
Set ts = fso_OpenTextFile("S:\NIS_staffshare\FdBk\bcmaLog.txt", ForAppending, False)
ts.WriteLine(strNdate & "^^" & strLoc & "^^" & strComment & "^^" & strUsername & "^^" & strUserTel)
ts.Close

(Makes a delimited text file.)


Any pointers?

Thank you.
 
NurseIS,

You should be able to open and write to the file as long as you have permissions.

On error Resume Next
Set ts = fso_OpenTextFile("S:\NIS_staffshare\FdBk\bcmaLog.txt", ForAppending, False)
If err.number <> 0 then
msgbox err.number & &quot; &quot; & err.description
End if

Try this. It should tell you what the problem is.

fengshui_1998

 
returns &quot;424 object required&quot;
I'll see if I can find the error listing in the books. Thanks!!!
 
Of course the error was found - but what to do about it ??? What object has to be declared when addressing a network drive path? The script works fine for a local path.

Thanks again.
 
First, the FSO makes no differentiation if the drive is local or network (mapped drive or unc).

The fact that you state it works for a local path, but not a mapped drive or UNC path, screams permission-issue, as FengShui1998 eluded. Check both share permissions and file permissions(ntfs).

Also, FengShui1998 omitted initializing the fso variable in the snippet above, if you also omitted it, you would get the &quot;424 object required&quot;.

Jon Hawkins
 
OK. Thought I'd checked permissions but will do. Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top