title: TypeError (0x800a01a8): Object required: 'Document'
body: <p>i have a classic asp page with inside the following vbscript 
  but it say that the Document object dose not exist why??</p>
  
  <pre><code>TypeError (0x800a01a8): Object required: 'Document'
  </code></pre>
  
  <p>the vbscript code:</p>
  
  <pre><code>&lt;script language="vbscript" RUNAT="Server"&gt;
  Function getDescriptionEstProc()
      Dim  CONNECTSTRING, QUALIFIER, QueryDescEstProc, dbConnect, res,output, param
  
      CONNECTSTRING = Session("CONNECTSTRING")
      QUALIFIER = Session("QUALIFIER")
  
      param = PageParams1.UIDMeterHistory
  
      QueryDescEstProc = "select e.description from meterhistory mh, meterread m, estimationprocess e where m.uidestproc = e.uidestproc  and m.uidmeter = mh.uidmeter and mh.uidmeterhistory = '"&amp; "0100001" &amp;"'"
  
      Set dbConnect = Server.CreateObject("ADODB.Connection")
      Set rsWQType = Server.CreateObject("ADODB.Recordset")
  
      dbConnect.Open CONNECTSTRING
  
      rsWQType.Open QueryDescEstProc, dbConnect
  
      res = ""
  
      Do While Not rsWQType.EOF 
          res = res &amp; rsWQType("description") &amp; ","
      Loop
  
      Dim TheForm 
      Set TheForm = Document.forms("Form1")
      TheForm.hiddenString.Value = res
  
      Response.Write res &amp; " - hello"
  
      getDescriptionEstProc = res
  
  
      End Function
  &lt;/script&gt;
  </code></pre>
  
  <p>(there is no aspx file)
  the .asp file:</p>
  
  <pre><code>  &lt;form name="Form1" method="post" onkeypress="if (event.keyCode==13) {this.submit();event.returnValue=false;} else event.returnValue=true;"&gt;
  &lt;input class="lookup" type=hidden name="Id" value="&lt;%=PageParams1.Id%&gt;"&gt;
  &lt;input type=hidden name="SessionId" value="&lt;%=PageParams1.SessionId%&gt;"&gt;
  &lt;input type=hidden name="Command" value=""&gt;
  &lt;input type=hidden name="AccountID" value="&lt;%=PageParams1.AccountID%&gt;"&gt;
  &lt;input type=hidden name="UIDFACILITY" value="&lt;%=PageParams1.UIDFACILITY%&gt;"&gt;
  &lt;input type=hidden name="FACILITYID" value="&lt;%=PageParams1.FACILITYID%&gt;"&gt;
  &lt;input type=hidden name="METERID" value="&lt;%=PageParams1.METERID%&gt;"&gt;
  &lt;input type=hidden name="UIDMETER" value="&lt;%=PageParams1.UIDMETER%&gt;"&gt;
  &lt;input type=hidden name="UIDMeterHistory" value="&lt;%=PageParams1.UIDMeterHistory%&gt;"&gt;
  &lt;input type=hidden name="CustomerName" value="&lt;%=PageParams1.CustomerName%&gt;"&gt;
  &lt;input type=hidden name="CustomerId" value="&lt;%=PageParams1.CustomerId%&gt;"&gt;
  &lt;input type=hidden name="EntityParam" value="&lt;%=PageParams1.EntityParam%&gt;"&gt;
  &lt;input type=hidden name="SORT_BY" value="&lt;%=PageParams1.SORT_BY%&gt;"&gt; 
  &lt;input type=hidden name="SORT_ORDER" value="&lt;%=PageParams1.SORT_ORDER%&gt;"&gt;
  &lt;input type=hidden name="Mode" value="&lt;%=PageParams1.Mode%&gt;"&gt;
      &lt;table class="SnapIn" cellpadding="0" cellspacing="0" border=0&gt;&lt;tr class="ToolsTabs"&gt;
    &lt;td class="Title"&gt;&lt;nobr&gt;&lt;%=Proxy1.i18n.FM("MeterHistory")%&gt;&lt;/nobr&gt;&lt;/td&gt;
    &lt;td class="ToolsLeft"&gt;
      &lt;b&gt;&lt;%=Proxy1.i18n.FM("ID")%&gt;&lt;/b&gt; &amp;nbsp; &lt;%=meterId %&gt;
          &lt;%if (PageParams1.Mode == "ServicePoint") {%&gt;
          &amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;a href="../../ccs/MainWebPart.aspx?Mode=
    &lt;%=PageParams1.Mode%&gt;&amp;SessionId=&lt;%=PageParams1.SessionId%&gt;&amp;Uid=
    &lt;%=Proxy1.Session.GetPropertyValue("SERVICEPOINT_UID")%&gt;"&gt;
    &lt;%=Proxy1.i18n.FM("ServicePointSummary")%&gt;&lt;/a&gt;
      &lt;% } else if (PageParams1.Mode == "MarketParticipant") { %&gt;
          &amp;nbsp;&amp;nbsp;|&amp;nbsp;&amp;nbsp;&lt;a href="../../ccs/MainWebPart.aspx?Mode=
    &lt;%=PageParams1.Mode%&gt;&amp;SessionId=&lt;%=PageParams1.SessionId%&gt;&amp;Uid=
    &lt;%=Proxy1.Session.GetPropertyValue("MARKETPARTICIPANT_UID")%&gt;"&gt;
    &lt;%=Proxy1.i18n.FM("MarketParticipantSummary")%&gt;&lt;/a&gt;
      &lt;% } %&gt;
    &lt;/td&gt;
    &lt;td class="ToolsRight"&gt;&lt;nobr&gt;&amp;nbsp;
          &lt;%if (PageParams1.AccountID) {%&gt;
        &lt;b&gt;&lt;%=Proxy1.i18n.FM("AccountID")%&gt;&lt;/b&gt;
        &lt;a class="Link" onclick='window.navigate("../viewaccount/Meters.asp?Id=&lt;%= escape(PageParams1.AccountID)%&gt;&amp;SessionId=&lt;%=PageParams1.SessionId%&gt;")'&gt;&lt;u&gt;&lt;%=PageParams1.AccountID %&gt;&lt;/u&gt;&lt;/a&gt;
      &amp;nbsp;&amp;nbsp;
      &lt;%} if (PageParams1.CustomerId) {%&gt;
      &lt;b&gt;&lt;%=Proxy1.i18n.FM("CustomerID")%&gt;&lt;/b&gt;
        &lt;a class='Link' onclick='navigate("../../ccs/MainWebPart.aspx?Id=&lt;%=escape(PageParams1.CustomerId)%&gt;&amp;SessionId=&lt;%=PageParams1.SessionId%&gt;"+"&amp;Mode=Customer")'&gt; 
            &lt;%=PageParams1.CustomerId%&gt;
        &lt;/a&gt;
        &amp;nbsp;&amp;nbsp;
        &lt;%} if (PageParams1.UIDFACILITY) {%&gt;
          &lt;b&gt;&lt;%=Proxy1.i18n.FM("FacilityID")%&gt;&lt;/b&gt;
          &lt;a class=Link onclick='navigate("../cust_facility/Basics.asp?UIDFACILITY=&lt;%=PageParams1.UIDFACILITY%&gt;&amp;SessionId=&lt;%=PageParams1.SessionId%&gt;&amp;X_ROWPERPAGE=50")'&gt;
              &lt;%=PageParams1.FACILITYID%&gt;
          &lt;/a&gt;
        &lt;%}%&gt;
    &lt;/nobr&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr&gt;
      &lt;td class="TabBox" colspan="3"&gt;&lt;%= RenderTabs("MeterRead") %&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;tr&gt;
      &lt;td class="Body" colspan="3"&gt;
      &lt;%          if (OperationError) ReportError(OperationError)%&gt;
  
      &lt;%if (PageParams1.Command=='Edit') { %&gt;
              &lt;table width=100%&gt;&lt;tr&gt;&lt;td class=LinkBox&gt;
                &lt;%if (Proxy1.Allow("//ACCTMGT/ACCTCOMP/ACCTMET/@UPDATE")) {%&gt;
                &lt;a href="javascript: Save()"&gt;&lt;%=Proxy1.i18n.FM("Save")%&gt;&lt;/a&gt; |
                &lt;%}%&gt;
                &lt;%if (PageParams1.EntityParam &amp;&amp; Proxy1.Allow("//ACCTMGT/ACCTCOMP/ACCTMET/@REMOVE") ) { %&gt;&lt;a href="javascript: Delete()"&gt;&lt;%=Proxy1.i18n.FM("Delete")%&gt;&lt;/a&gt; |&lt;% } %&gt;
                &lt;a href="javascript: Cancel()"&gt;&lt;%=Proxy1.i18n.FM("Cancel")%&gt;&lt;/a&gt;
              &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
      &lt;%} else%&gt;
          &lt;%=tMeterHistoryTable %&gt;
  
      &lt;%if (PageParams1.Command != 'Edit') { %&gt;
          &lt;table style="width: expression(Math.max(document.body.offsetWidth-55, 540))"&gt;
          &lt;tr&gt;
          &lt;td align=left&gt;
          &lt;%
                      if (Proxy1.Allow("//FACILITY/ADD"))
                      {
                  %&gt;
                                  &lt;a href="javascript: Edit()" &gt;&lt;%=Proxy1.i18n.FM("Add")%&gt;&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                  &lt;%
                      }
                      if (Proxy1.Allow("//FACILITY/REEST_ACTION/@REESTIMATE")) { %&gt;
                                  &lt;a href="javascript: reestimate()"&gt;Ristima&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                  &lt;%
                      }
                      if (Proxy1.Allow("//FACILITY/REEST_ACTION_2")) { %&gt;
                                  &lt;a href="javascript: reestimate2()"&gt;Ristima lettura conferimento&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                  &lt;%  }
                      if (Proxy1.Allow("//FACILITY/REEST_ACTION/@DISCHARGE")) { %&gt;
                                  &lt;a href="javascript: discharge()"&gt;Scarta&lt;/a&gt;
                  &lt;%  } %&gt;
                              &lt;/td&gt;
                              &lt;!--Indicazione righe e pagina--&gt;
                              &lt;td align=right&gt;
                              &lt;%= Paginator_b(PageParams1.ROWPERPAGE, PageParams1.PAGENUMBER) %&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      &lt;/table&gt;
              &lt;%
                  } 
              %&gt;
  &lt;div class="mAppScroll" style="height:100% width:100%"&gt;&lt;% =tTable %&gt;&lt;/div&gt;
  &lt;tr&gt;
                          &lt;td&gt;
                              &lt;!--Cannata Alberto - modifica del 09/10/2006: aggiorniamo i campi LSUSER e LSTIME della METERHISTORY.--&gt;
                              &lt;input type="hidden" name = "OLD_STATUS" value = "&lt;%=oldstatus_str%&gt;"&gt;
                              &lt;input type="hidden" name = "X_LSUSER" value = "&lt;%=username_web.toUpperCase()%&gt;"&gt;
                              &lt;input type="hidden" name = "X_LSTIME" value = "&lt;%=data_modifica%&gt;"&gt;
                          &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;&lt;!-- /SnapIn --&gt;
  &lt;input type="hidden" id="hiddString" name="hiddenString" value=""&gt;
  &lt;% 
      getDescriptionEstProc();
  %&gt;
  
  &lt;SCRIPT language="javascript"&gt;
      appendColumn();
  &lt;/SCRIPT&gt;
  </code></pre>
  
  <p>
  </p>