SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast aliaga61's Avatar
    Join Date
    Sep 2003
    Location
    cincinnati, oh
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    'Object required' error

    I am trying to run this code that will return the information in an email...i've tried running the queries seperately in query analyzer and sql plus...and they work fine. when i run the page i get an object required error message:

    Microsoft VBScript runtime error '800a01a8'
    Object required: ''

    /test/testbasket.asp, line 85


    line 85 is referring to the set adoRS2 = adoConn.Execute(strSQL) line
    it can't be a connection issue because that's how i've handled all of my other queries in the past and they worked fine. any help would be appreciated.


    'get work orders whose baskets have changed, with a status of assigned and a dash order or 1, within the last two hours
    StrSQL = "Select t.tsnumb, t.tsid, wb.wcseqn, wb.wcbask, wb.wcstat, wb.wcdate from tsr t, wobaskdtl wb where t.tsnumb=wb.wcnumb and wb.wcseqn='1' and wb.wcdate >= sysdate - interval '2' hour and wb.wcstat='A' and wb.wcbask like 'R0%' and t.tsid is not null order by t.tsnumb"
    Set adoRS = adoConn.Execute(StrSQL)

    do until adoRS.EOF

    strWONumb = adoRS(0)
    strUserID = adoRS(1)
    strSequence = adoRS(2)
    strBasket = adoRS(3)
    strStatus = adoRS(4)
    strDate = adoRS(5)

    'beginning of email. standard for all users
    Dim MyCDONTSMail2
    Dim HTML
    Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
    HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"
    HTML = HTML & "<html>"
    HTML = HTML & "<head>"
    HTML = HTML & "<title>Work Order Status</title>"
    HTML = HTML & "</head>"
    HTML = HTML & "<body bgcolor=""FFFFFF"">"
    HTML = HTML & "<font size =""3"" face=""Arial"">"
    HTML = HTML & "test for WO Basket Change.<br><br>"

    'get person's info (id,email)
    StrSQL = "Select usr.CMEMAL, usr.CMORGA from tblUserInfo usr where usr.USERID ='" & strUserID & "'"
    Set adoRSWEBtest2 = adoConnWEBtest2.Execute(StrSQL)

    strUserEmail = adoRSWEBtest2(0)
    strUserOrg = adorRSWEBtest2(1)

    'get cmo info (id,name,email,phone)
    strSQL = "Select Distinct substr(ORTCON,1,6), ORORGA from ORGCODE where ORORGA = '" & strUserOrg & "' order by ORORGA"
    set adoRS2 = adoConn.Execute(strSQL)

    do until adoRS2.EOF
    strAcctNo = adoRS2(0) + "%"

    strSQL = "Select Distinct cmo.CMOID, cmo.CMOROLE, cmo.ACCTNO, usr.USERID, usr.CMFNAM, usr.CMMNAM, usr.CMLNAM, usr.CMEMAL, usr.CMPHON, usr.CMEXTN, usr.CMPREFIX from tblCMOList cmo, tblUserInfo usr where cmo.CMOID=usr.USERID and cmo.ACCTNO= '" & strAcctNo & "' order by cmo.CMOROLE desc"
    set adoRSWEBtest3 = adoConnWEBtest3.Execute(strSQL)

    Do While Not adoRSWEBtest3.EOF
    strRole = adoRSWEBtest3(1)
    strFullName = adoRSWEBtest3(4) + " " + adoRSWEBtest3(5) + " " + adoRSWEBtest3(6)
    strEmail = adoRSWEBtest3(7)
    strExt = adoRSWEBtest3(9)
    strTele = adoRSWEBtest3(8)
    strPrefix = adoRSWEBtest3(10)

    'format telephone number to include "()" and "-"
    if Len(strTele) = 10 then
    strFormatted = "(" & mid(strTele,1,3) & ") " & mid(strTele,4,3) & "-" & mid(strTele,7,4)
    else
    'if not a 10 digit number, don't format the number
    strFormatted = strTele
    end if

    'display cmos' information
    HTML = HTML & "" & strPrefix & " " & strFullName & " (" & strRole & ") <br>"
    HTML = HTML & "" & strEmail & "<br>"
    HTML = HTML & "" & strFormatted & "<br><br>"

    'place cmos' email addresses into one string for "to" field of email
    strListing = trim(strEmail) & "; " & strListing
    adoRSWEBtest3.MoveNext
    Loop
    adoRS2.MoveNext
    loop

    HTML = HTML & "<br><br>"
    HTML = HTML & ""& strCurrentTime &" "
    HTML = HTML & " "& adoRS(0) &" "
    HTML = HTML & " "& adoRS(2) &" "
    HTML = HTML & " "& adoRS(1) &" "
    HTML = HTML & " "& adoRS(3) &" "
    HTML = HTML & " "& adoRS(4) &" "
    HTML = HTML & " "& adoRS(5) &"<br>"
    HTML = HTML & "<br>"

    'closing of email. Standard for all users with the exception of the "to" field
    HTML = HTML & "Thank You,<br>"
    HTML = HTML & "DMATS<br>"
    HTML = HTML & "CMOs Email" & strListing & "<br>"
    HTML = HTML & "User's Email" & strUserEmail & "<br>"
    HTML = HTML & "</body>"
    HTML = HTML & "</html>"
    MyCDONTSMail2.From= "aliaga61@earthlink.net"
    MyCDONTSMail2.To="aliaga61@earthlink.net"
    MyCDONTSMail2.Subject="WO Basket Change"
    MyCDONTSMail2.BodyFormat=0
    MyCDONTSMail2.MailFormat=0
    MyCDONTSMail2.Body=HTML
    MyCDONTSMail2.Send
    set MyCDONTSMail2=nothing

    adoRS.MoveNext
    loop

  2. #2
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is strSQL all on one line??

  3. #3
    SitePoint Enthusiast aliaga61's Avatar
    Join Date
    Sep 2003
    Location
    cincinnati, oh
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, that's just the way it displays in the post

  4. #4
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thats what I was asking.

    Where is adoConnWEBtest3?? Post what you have for that.

  5. #5
    SitePoint Enthusiast aliaga61's Avatar
    Join Date
    Sep 2003
    Location
    cincinnati, oh
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i figured out my mistake...i shouldn't have been naming my connection adoConnWEBtest1,2,3,etc....took the numbers off and it work fine...thanks for the help.

  6. #6
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aliaga61
    i figured out my mistake...i shouldn't have been naming my connection adoConnWEBtest1,2,3,etc....took the numbers off and it work fine...thanks for the help.
    I'm rather surprised that's the solution to your problem - naming a variable with a numeric suffix should make absolutely NO difference at all. It's giving a variable a numeric prefix which isn't allowed.

    I question whether the SQL statement that you were executing actually returns any records - if not (e.g. it's an INSERT/UPDATE/DELETE statement), then there is no recordset, hence no object, and therefore your error would make perfect sense!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  7. #7
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WHere's my error coming from?

    WHere's my error coming from?

    INSERT INTO results SELECT * FROM bible WHERE text_data LIKE '%ezra%' AND text_data LIKE '%%' AND text_data LIKE '%%'
    Microsoft VBScript runtime error '800a01a8'

    Object required: 'Driver={Microsoft Ac'

    /kjvresp.asp, line 275
    line 275:
    Code:
    Set RS = strConn.execute("SELECT * FROM results")
    Code:
    Private Function GetConnectionString()
        GetConnectionString =   "Driver={Microsoft Access Driver (*.mdb)};" & _
                    "DBQ=" & Server.MapPath(DB_NAME) & ";" & _
                    "UID=;PWD=;"
    End Function
    
    ' Shows HTML page header 
    Public Sub OutputPageHeader()
        %>
        <HTML>
        <HEAD><TITLE>Result Page</TITLE>
        <SCRIPT LANGUAGE="JavaScript">
    function checkAll(form,cbox)
    {
    var ct;
    if(cbox.checked == true)ct = true;
    else if(cbox.checked == false)ct = false;
        for(var i = 0; i < form.length; i++)
        {
            if(form[i].type=='checkbox')form[i].checked = ct;
        }
    }
    </SCRIPT>
    
    </HEAD>
    <BODY>
    
        <%
    End Sub
    
    ' Shows HTML page footer 
    Public Sub OutputPageFooter()
        %>
    <!--#include file="biblepagebottom.txt"-->
        <%
    End Sub
    
    ' This function will display the search form
    Private Sub ShowSearchForm()
        call OutputPageHeader()
        %>
        <!--
            This form will direct user to itself with MODE_RESULTS mode
        -->
        <%
    ' This function will display the results of the search
     call ShowResults()
    End Sub
    
    Sub ShowResults()
        Dim strConn     ' Database connection string
        Dim secondConn
        Dim SQL         ' String that will have our SQL statments
        Dim RS          ' Recordset object
        Dim secondRS
        Dim Keyword     ' Keyword for search
        Dim nRecCount   ' Number of records found
        Dim nPageCount  ' Number of pages of records we have
        Dim nPage       ' Current page number
        Dim iCounter
        Dim iLoopCount
        Dim aRecTypes
        Dim spoke       ' For dropdown
        Dim number
        Dim Keywordb
        Dim Keywordc
        Dim intRec
    
        ' define our SQL statement
        ' we will be looking for all the records in tblItem table 
        ' where ItemName contains our Keyword
        ' do not forget to fix tick marks (single quotes) in our Keyword
    
        SQL = "INSERT INTO results SELECT * FROM bible WHERE "
    
        strConn = GetConnectionString()
    
        ' Let's see what page are we looking at right now
        nPage = CLng(Request.QueryString("Page"))
    
        ' Let's see what user wants to search for today :)
        Keyword = Trim(Request.QueryString("Keyword"))
        spoke = Request.Querystring("spoke")
        number = Request.QueryString("number")
        Keywordb = Request.QueryString("Keywordb")
        Keywordc = Request.QueryString("Keywordc")
    
    'Set conn = Server.CreateObject("ADODB.Connection")  
    'conn.Open(GetConnectionString)              
    
    iCounter = 0
    
    If   request.QueryString("text_data")="yes" then
    
      SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "  
      SQL = SQL & "text_data LIKE '%" & Keywordb & "%' AND "
      SQL = SQL & "text_data LIKE '%" & Keywordc & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    
    If   request.QueryString("book")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "book LIKE '" & number & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    
    If   request.QueryString("book_title")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "book_title LIKE '%" & number & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("chapter")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "chapter LIKE '%" & number & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("verse")="yes" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "verse LIKE '%" & number & "%'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("book_spoke")="Book_Spoke" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "book_spoke = '" & spoke & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("chapter_spoke")="Chapter_Spoke" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "chapter_spoke = '" & spoke & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    If   request.QueryString("verse_spoke")="Verse_Spoke" then
    
      If iCounter > 0 Then
        SQL = SQL & " AND "
      End If
    
      SQL = SQL & "verse_spoke = '" & spoke & "'"
    
      iCounter = iCounter + 1
    
    end if
    
    If Trim(Request.QueryString("recordType")) <> "" Then
    
    
      aRecTypes = Split(Request.QueryString("recordType"), ",")
    
      If IsArray(aRecTypes) Then 'This is a bit redundant, but it can't hurt
        SQL = SQL & " AND ("
    
        For iLoopCount = 0 To UBound(aRecTypes)
          If iLoopCount <> 0 Then
            SQL = SQL & " OR "
          End If
    
          SQL = SQL & " recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
        Next
      End If
      SQL = SQL & ")"
    End If
    Response.Write  SQL
    ' Time to create and open recordset
        Set RS = Server.CreateObject("ADODB.Recordset")
    
       RS.CursorLocation = adUseClient
        RS.Open SQL, strConn, adOpenForwardOnly, adLockReadOnly
            Set RS = strConn.execute("SELECT * FROM results")
    
    set RS = nothing
    RS.Close
    Set strConn = nothing
    strConn.Close
    
        ' Finish this page
        Call OutputPageFooter()
    End Sub
    
    %>
    </body>
    </html>

  8. #8
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gilgalbiblewheel
    WHere's my error coming from?

    line 275:
    Code:
    Set RS = strConn.execute("SELECT * FROM results")
    It would appear that strConn is a string, not an instance of an ADODB.Connection object...!

    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  9. #9
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the string the keyword being searched?

  10. #10
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gilgalbiblewheel
    Is the string the keyword being searched?
    Ummm.... that doesn't make any sense.

    The problem is that you are using the variable strConn as if it were a Connection object (you're invoking the .execute() method on it), but it's actually just a string. You need to create a Connection object first, then assign strConn as the connection string, and then invoke the .execute() method on the Connection object.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •