Results 1 to 2 of 2

Thread: OpenTextFile Question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780

    OpenTextFile Question

    I am working with classic ASP (not by choice) and I am attempting to create a Log File for each day of operation.

    First I check to make sure that the file exists
    If it does then I open the file to append some data at the end of the file

    If it doesn't I create the file and add some data to it.

    My problem is when I attempt to open the existing file to append some data to it. I've looked all over the internet to see what the problem is but my code seems to be fine. Can some one take a look at the code and tell me what is wrong with it?

    Here is me code
    Code:
    Set LogDFS=Server.CreateObject("Scripting.FileSystemObject")
    
    'Checking to see if the file exists
    If LogDFS.FileExists(strOutputFile) Then
    	'The File exists, so it will be opened and data will be added to the end of the file
    	Set LogDFO=LogDFS.GetFolder("X:\Customers\Wellness\Amazon_results\LogFiles")
    	Set LogFile=LogDFO.OpenTextFile("X:\Customers\Wellness\Amazon_results\LogFiles\" & SelectDay & ".txt", 8)
    'The file does not exist, so it will be created
    Else
    	Set LogDFO=LogDFS.GetFolder("X:\Customers\Wellness\Amazon_results\LogFiles")
    	Set LogFile=LogDFO.CreateTextFile(SelectDay&".txt", true)
    	LogFile.writeline(Now() & " File Created")
    	LogFile.writeline("*************************************")
    End If
    Here is the error that I am receiving:
    Error Type:
    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method: 'OpenTextFile'
    /AmazonTest/AmazonTest.asp, line 19


    I think maybe I just need another set of eyes to look at the code..
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  2. #2
    Addicted Member
    Join Date
    Jul 2009
    Posts
    208

    Re: OpenTextFile Question

    OpenTextFile is a method of the FSO class, so:

    .... LogDFS.OpenTextFile(....

    The same applies to CreateTextFile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width