Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2004, 11:56 AM
Registered User
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Group By

Hi,
Can somebody please help. I have a program that after it runs it creates a report based on several tables. Everything works great except for one thing. I have the following code that sets up the report. The problem is that although it groups the id field it does not put like id in one line with a total for the qty field. I would like to report to put identical id in one line.
Any help?
Todd
For example:

id qty
2412 20
2413 10
2414 20

Not Like This

Id qty
2412 5
2412 5
2412 5
2412 5

Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim cn As New ADODB.Connection
Dim strSQL As String
cn.Open "Provider=MSDATASHAPE; data Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Invpath & "\data\Inventory.mdb;Persist Security Info=False"
strSQL = "Select * from jobpart where jobid='" & jobinprocessRS!JOBID & "'"
With cmd
    .ActiveConnection = cn
    .CommandType = adCmdText
    .CommandText = " SHAPE {" & strSQL & "} AS cmdGroup1 Compute cmdGroup1 BY 'id'"
    .Execute
End With
With rs
    .ActiveConnection = cn
    .CursorLocation = adUseClient
    .Open cmd
End With
With DataReport3
    Set .DataSource = rs
    .DataMember = ""
'this for group header
    With .Sections("section2").Controls
        .Item("Text1").DataField = "id"
    End With
'this for group details
    With .Sections("Section1").Controls
        .Item("Text2").DataMember = "cmdGroup1"
        .Item("Text2").DataField = "id"
        .Item("Text3").DataMember = "cmdGroup1"
        .Item("Text3").DataField = "qty"
    End With
    .Refresh
    .Show
End With






Similar Threads
Thread Thread Starter Forum Replies Last Post
Group Within another Group, xslt1.0 jhansib4u BOOK: XSLT Programmer's Reference, 2nd Edition 4 November 22nd, 2007 01:24 AM
Restart new group number in Group Footer sukarso Crystal Reports 2 October 13th, 2006 12:11 PM
Group by , Sub Group by and Sum mateenmohd SQL Server 2000 1 March 29th, 2005 09:51 AM
Group edramail Crystal Reports 0 May 18th, 2004 05:51 AM
Group By andrekl SQL Server 2000 16 November 10th, 2003 11:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.