Microsoft VBScript runtime error '800a01a8'  - Object required

Posted on 2006-05-30
Medium Priority
Last Modified: 2008-01-09

I have a puzzling question.  i got the error Microsoft VBScript runtime error '800a01a8'  - Object required on  page 2 but when I click back to the Page1 and then click Submit again, the page works!  

what I'm trying to say is that it doesn't work the first time but is able to update on the second try (after I click the back Button  and then the Submit buttonin IE).    

This is the code on Page 2.

<!--#include file="../Connections/OnlineRegistration.asp" -->
<%  Dim con, sql_update
sql_update = "Update Pendaftaran Set Nama = '"& Session("NamaValue") &"', NIP = '"& Session("NIPValue") &"' Where PendaftaranID = " & Session("PendaftaranID") & " " 
        Set con = Server.CreateObject("ADODB.Connection")
                  con.Open MM_OnlineRegistration_STRING                      --> Error line
        con.Execute sql_update  
        Set con = nothing
        Response.Redirect ("DaftarPerserta.asp?KursusID=" & Session ("KursusID"))

I'm sure it works cos it's able to update on the second try (but not the 1st time)
Question by:limhodav
  • 3
  • 2

Accepted Solution

SimonBlake earned 1000 total points
ID: 16796448

Can you response.Write the value of the MM_OnlineRegistration_STRING before the open so you can see if it is the same?
Also, put an Option Explicit into the page at the top as this forces the runtime to do a few extra checks (But makes the code run slightly aster)


Author Comment

ID: 16796774
Have done so. It's exactly the same as the rest of the pages.  

The funny thing is that it works first time when I run it under localhost.  But after uploading to actual site, it can only run on the second try.  This is perplexing.  

Author Comment

ID: 16796913
I've added Option Explicit and miraculously it worked .... don't understand why but happy as long as it works

Expert Comment

ID: 16796941
Basically, when you use option explicit, the system scans the ASP for variables and objects used for and attempts to match them with Dim statements. Once it comes across one it creates an object store for it before executing the code.

Under certain versions of the script engine, dynamically created objects didn't get properly initialised when they got thier Set statement until the page was cached in the ASP memory block. So on occasion you got that error. I learnt this from Microsoft on a specialist IIS course about 6 years ago where we tested different methods of coding in ASP... Had a great example of a piece of bad db access looping thru 100 records that through the cache engine ran about 20% faster than the proper way of doing it due to the way ASP cached stuff. Once it got to 120 records the thing reversed in performance...

Author Comment

ID: 16797368
Thanks a lot for enlightening me.  

I'm actually only a part time programmer who self-taught ASP on his own through the internet.

Perhaps, the first time when it didn't worked is due to the fact that the object has not been cached yet. After that, it can work on the 2nd time.  

Thanks once again.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question