Re: Object Variable not set error
From: Tom Lavedas (tlavedas_at_hotmail.remove.com)
Date: 10/21/04
- Next message: Maurice zmau: "Newby question : How to Create Directory ?"
- Previous message: pldz: "Random NUmber Generator creates duplicates"
- In reply to: McKirahan: "Re: Object Variable not set error"
- Next in thread: McKirahan: "Re: Object Variable not set error"
- Reply: McKirahan: "Re: Object Variable not set error"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 21 Oct 2004 09:39:06 -0700
The correct syntax is Exit Do, not exit loop.
Tom Lavedas
===========
"McKirahan" wrote:
> "Erica" <Erica@discussions.microsoft.com> wrote in message
> news:C4276A5D-6F28-470B-B149-C7B14B617A30@microsoft.com...
> > I'm getting this error:
> >
> > Microsoft VBScript runtime error '800a005b'
> >
> > Object variable not set
> >
> > /poll.asp, line 16
> >
> >
> > Here is my code:
> >
> > <%
> > if session("whois")="" then
> > response.Redirect("default.asp")
> > else
> > Set fs=Server.CreateObject("Scripting.FileSystemObject")
> > Set f=fs.OpenTextFile(Server.MapPath("voters.txt"), 1)
> >
> > do while f.AtEndOfStream = false
> > If f.readline = session("whois") then
> > AlreadyVoted = true
> > f.close
> > end if
> > loop
> >
> > If AlreadyVoted <> true then
> > Set f=fs.OpenTextFile(Server.MapPath("voters.txt"), 2)
> > f.writeline(session("whois"))
> > f.Close
> > Set f=Nothing
> > Set fs=Nothing
> > else
> > Set f=fs.OpenTextFile(Server.MapPath("voters.txt"), 2)
> > f.Close
> > Set f=Nothing
> > Set fs=Nothing
> > %>
> > <script language="JavaScript">
> > alert("The user currently logged in has already voted. If you are not the
> > user specified on the main page, log out and then login with your own
> > username and password.");
> > javascript:history.back();
> >
> > </script>
> > <%
> > end if
> >
> > Please help. Thank you all in advance for your help.
> >
>
> Just a guess after a quick review...
>
> do while f.AtEndOfStream = false
> If f.readline = session("whois") then
> AlreadyVoted = true
> f.close
> end if
> loop
>
> Try adding "exit loop" after "f.close" as you're trying to read a record
> after you closed the file.
>
>
>
- Next message: Maurice zmau: "Newby question : How to Create Directory ?"
- Previous message: pldz: "Random NUmber Generator creates duplicates"
- In reply to: McKirahan: "Re: Object Variable not set error"
- Next in thread: McKirahan: "Re: Object Variable not set error"
- Reply: McKirahan: "Re: Object Variable not set error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|