Anyway to ouput SUM of each company??

NauticaX

New Member
Joined
Feb 4, 2005
Messages
13
I have the following code in aspx file. It will pull the Saleman Name Gross Sales Product Freight Delivery Other Product Cost Freight Cost Delivery Cost

Is there anyway I can sort the output by Name.. and since Name will show up a couple times with diff. Sales each time combine all the similar Name and have the Sum of Gross Sales, Product, Freight Delivery, etc show up?

Thanks in advance.


script runat="server">

Sub Button_Click( s As Object, e As EventArgs )

Dim myConnection As oledbConnection
Dim strselect As String
Dim myCommand As oledbCommand
Dim dtmdate as datetime

dtmdate= datetime.now()

myconnection = new oledbconnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\data\plmaster.mdb")
strselect = "select ardetail.ri_saleman as [Saleman] , plmaster.pl_name as [Name] , ardetail.ri_grs_amt as [Gross Sales] ,

ardetail.ri_product as [Product] , ardetail.ri_freight as [Freight] , ardetail.ri_delvery as [Delivery] , ardetail.ri_design as

[Other] , ardetail.ri_invcost as [Product Cost], ardetail.ri_frtcost as [Freight Cost] , ardetail.ri_dlvcost as [Delivery Cost]

from ardetail, plmaster where ardetail.ri_proname = plmaster.pl_file and ardetail.ri_invdate>#12/31/2003# and

ardetail.ri_invdate<#01/01/2005# and ardetail.ri_trantyp='i'"
mycommand = new oledbcommand ( strselect, myconnection )

response.write(dtmdate.tostring ("D"))

myConnection.Open()

DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DataGrid1.DataBind()

End Sub

/script>
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I would suggest that you create the required totals query in the plmaster database.

Then goto View>SQL and copy the statement there into your code.
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,419
Members
451,765
Latest member
craigvan888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top