public function count()
  {
    // start the query if recordSet is not yet initialised 
    // if the recordSet is initialised it doesn't matter if its used or not
    if (is_null($this->recordSet))
    {
      $this->fetchData();
    }
    if(is_null($this->recordcount)){
      // store the number of records returned
      $this->recordcount = $this->recordSet->RecordCount();
    }
    return $this->recordcount;
  }