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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft VBScript runtime error '800a0036' - Bad file mode

Status
Not open for further replies.

Dabar

Programmer
Jan 28, 2000
1
US
I am receiving the following ASP error message:

-----------------------------------------------
Microsoft VBScript runtime error '800a0036'

Bad file mode

-----------------------------------------------

I create a FileSystemObject in these lines:

Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set CurFile = FSO.OpenTextFile(Server.MapPath("Current.txt"))

I recieve the error message during execution of the following line:

CurFile.WriteLine(CurrentPerson)

The variable, CurrentPerson, contains a string value.
If I comment this line out, the page runs fine.

What am I missing?
 
The file must be opened for Input. I dont know VBScript so i can't tell you how to fix it but look for another parameter to the OpenTextFile method that will open the file for Output instead of Input. Ruairi
ruairi@logsoftware.com
Experienced with:

VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions

ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications
 
Dabar, you can pass three parameters to the OpenTextFileMethod. In your case:

Set CurFile = FSO.OpenTextFile(Server.MapPath("Current.txt"), FOR_APPENDING, true)

where FOR_APPENDING is a constant (integer: 8) that tells that you are appending to the file. There is an include file you can use (gives you forAppending, forWriting, etc.)so you can have these variables, but I usually create my own constants.
to append to the file: 8
to write over the file: 2
to read from the file: 1

true - if the file does not exist, create it


ray
rheindl@bju.edu

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top