Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using ADO SHAPE command (Access 2000 Win 2000 SR-1)

    I am trying to replicate programmically the grouping and ordering function of an Access report using ado and asp and the SHAPE command. I have gotten things set up to open the MSDataShape provider and feed it a SHAPE string like this:
    <font color=d2691e>
    objCommand.CommandText = "SHAPE " & _
    "{SELECT Categories, CRCGType, MemberType FROM tblOutlookContacts} " & _
    "APPEND ({SELECT Categories, FullName, Email1Address FROM tblOutlookContacts} " & _
    "RELATE Categories TO Categories)"
    </font color=d2691e>
    That seems to parse fine but on outputting the SHAPE command I get an error
    <font color=red>
    Microsoft VBScript runtime error '800a01a8'

    Object required: '[string: "Brooks, Duval, Jim_W"]'
    </font color=red>
    when using the following asp to print the results out:
    <font color=d2691e>
    Do while Not objRS.EOF
    Response.Write "Counties Covered: " & objRS("Categories") & _
    "CRCG Type: " & objRS("CRCGType") & _
    "Member Type: " & objRS("MemberType") & _

    SET rsCategories = objRS("Categories").Value

    While Not rsCategories.EOF
    Response.Write "Name: " & objRS("FullName") & _
    "Email Address: " & objRS("Email1Address") & _
    Wend
    objRS.MoveNext
    Response.Write "<hr>"
    LOOP
    </font color=d2691e>
    where the offending line is the SET section in the output code. I'm completely new to the SHAPES structure and have been looking at MSDN articles for help. I think there may be a problem trying to assign the parent correctly (which is Categories, a series of County names comma-separated). Any ideas on what might be happening here?

    I've taken this discussion up in the web design and scripting forum but it was advised that i ask the Access mavens as this may have to do with the proper use of SHAPE.

    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: using ADO SHAPE command (Access 2000 Win 2000 SR-1)

    I'm sorry but I can't figure out what you're doing. I've worked with SHAPE, but you're code is too fragmentary to figure out. Where does objRS come from and why are you trying to set what looks like a recordset variable to a value? You use the SET keyword to instantiate an object, not to assign a value.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: using ADO SHAPE command (Access 2000 Win 2000 SR-1)

    sorry if i didn't post enough of the code. I have this as the objRS source:
    <font color=448800>
    Set objConn = Server.CreateObject("ADODB.Connection")
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objConn.Open = "Provider=MSDataShape; Data Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("") & "MDBCRCG_Contacts.mdb;"
    </font color=448800>
    As for using SET I was trying to adapt some code on a tutorial site:
    <font color=448800>
    ' Loop through the publishers
    Response.Write "<UL>"
    While Not rsPublishers.EOF
    Response.Write "<LI>" & rsPublishers("Pub_Name")

    To access the child recordset, we set a variable to point to the Value of the field containing the child. In this case it's rsTitles:

    ' Now the titles
    Response.Write "<UL>"
    Set rsTitles = rsPublishers("rsTitles").Value

    The variable rsTitles is now a recordset, and behaves just like an ordinary one. So, we can loop through the values for this recordset, which only contains titles for the matching parent Publisher:

    ' Loop through the titles
    While Not rsTitles.EOF
    Response.Write "<LI>" & rsTitles("title")
    rsTitles.MoveNext
    Wend
    Response.Write "[/list]"

    ' Move to the next publisher
    rsPublishers.MoveNext
    Wend
    Response.Write "[/list]"

    rsPublishers.Close
    Set rsPublishers = Nothing
    Set rsTitles = Nothing
    %>
    </font color=448800>
    As you can see, the example code uses SET rsTitles = rsPublishers("rsTitles").value and I read that as a recordset value (that is, the parent data to the child details)

    From what I've got so far, I can successfully open and execute the SHAPE command but it does indeed appear that the SET part is faulty. Are you supposed to use SET to indicate an alias for the parent SELECT string and how do you load the value for each 'header' part in the SHAPE output?

    Another thing I've noticed is doing SHAPE commands badly can cause asp to become a huge memore hog. I've had to reboot twice in testing. But, as the germans say, 'C'est le vie'.

Posting Permissions

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