Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could I use loop for this?

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
In my SQL on the page I select a certain set of records and then display them all on screen. Each record has a start date.

What I would like to be able to do is as the records are looped and placed on the page to look at the start date and place a table around each start date grouping and place the start date at the top of each of these tables.

So in the end there will be so many grey boxes depending upon the start dates displayed and the date relating to each grouping at the top of each of these boxes.

I think I could loop this to get the result but not sure how to go ahead and finish the task!

Thanks...
 
It quite easy using SHAPE-ing in your SQL querryes... ________
George, M
 
I can't seem to find a great deal about shape in the forum... clues or suggestions please!

Thank you...
 
Right now i trying to deal with this...
________
George, M
 
Here is the code i've found....

Code:
   Dim cnn 
   Dim rst 
   Dim rstTitleAuthor 
   Set cnn=Server.CreateObject("ADODB.Connection")
   Set rst=Server.CreateObject("ADODB.Recordset")
   Set rstTitleAuthor =Server.CreateObject("ADODB.Recordset")

   cnn.Provider = "MSDataShape"
   cnn.Open    "Data Provider=MSDASQL;" & _
               "Data Source=place your sql server name here;User Id=sa;Password=;Database=Pubs"
' STEP 1
   rst.StayInSync = FALSE
   rst.Open    "SHAPE  {select * from authors} "  & _ 
               "APPEND ({select * from titleauthor} " & _
               "RELATE au_id TO au_id) AS chapTitleAuthor", _
               cnn
' STEP 2
   While Not rst.EOF
      Debug.Print    rst("au_fname"), rst("au_lname"), _
                     rst("state"), rst("au_id")
' STEP 3
      Set rstTitleAuthor = rst("chapTitleAuthor").Value
' STEP 4
      While Not rstTitleAuthor.EOF
         Debug.Print rstTitleAuthor(0), rstTitleAuthor(1), _
                     rstTitleAuthor(2), rstTitleAuthor(3)
         rstTitleAuthor.MoveNext
      Wend
      rst.MoveNext
   Wend

This create in the first recordset, in an field, another recordset grouped by the au_id.
I your example u must group by the date field
Hope this gives u an ideea if not please tell me... ________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top