Advertisement
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 04/09/2008 at 01:50PM PDT, ID: 23309716 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: |
This is the query
SELECT QuotesFile.Theater, QuotesFile.Country, QuotesFile.[Created By User Type], ([Customer Name]) AS Customer, IIf([Created By User Name] Is Null,"EMPTY",UCase([Created By User Name])) & " - " & [Created By User Type] AS [Created by], IIf([Converted By User Name] Is Null,"EMPTY",UCase([Converted By User Name])) & " - " & [Converted By User Type] AS [Converted by], Sum(IIf(QuotesFile.[Created By Source]='CSCC' And QuotesFile.[Create Convert]=0,1,0)) AS [CSCC-Q], Sum(IIf([Created By Source]="CSCC" And QuotesFile.[Create Convert]=0,QuotesFile.[Net Price],0)) AS [CSCC-Q-V], Sum(IIf(QuotesFile.[Created By Source]='IQT' And QuotesFile.[Create Convert]=0,1,0)) AS [IQT-Q], Sum(IIf([Created By Source]="IQT" And QuotesFile.[Create Convert]=0,QuotesFile.[Net Price],0)) AS [IQT-Q-V], Sum(IIf(QuotesFile.[Created By Source]='SCC' And QuotesFile.[Create Convert]=0,1,0)) AS [SCC-Q], Sum(IIf([Created By Source]="SCC" And QuotesFile.[Create Convert]=0,QuotesFile.[Net Price],0)) AS [SCC-Q-V], Sum(IIf([Created By Source]="CSCC",1,0))/Count([ID]) AS [QAR %], Sum(IIf(QuotesFile.[Created By Source]='CSCC' And QuotesFile.[Create Convert]=1,1,0)) AS [CSCC-O], Sum(IIf([Created By Source]="CSCC" And QuotesFile.[Create Convert]=1,QuotesFile.[Net Price],0)) AS [CSCC-O-V], Sum(IIf(QuotesFile.[Created By Source]='IQT' And QuotesFile.[Create Convert]=1,1,0)) AS [IQT-O], Sum(IIf([Created By Source]="IQT" And QuotesFile.[Create Convert]=1,QuotesFile.[Net Price],0)) AS [IQT-O-V], Sum(IIf(QuotesFile.[Created By Source]='SCC' And QuotesFile.[Create Convert]=1,1,0)) AS [SCC-O], Sum(IIf([Created By Source]="SCC" And QuotesFile.[Create Convert]=1,QuotesFile.[Net Price],0)) AS [SCC-O-V], Sum(IIf([Converted By Source]="CSCC",1,0))/Count(IIf([Converted By Source],1,0)) AS [OAR %], QuotesFile.[Creation Date]
FROM QuotesFile
WHERE (((QuotesFile.[Creation Date]) Between [Forms]![frmDataAnalysis]![txtFOM] And [Forms]![frmDataAnalysis]![txtEOM]))
GROUP BY QuotesFile.Theater, QuotesFile.Country, QuotesFile.[Created By User Type], ([Customer Name]), IIf([Created By User Name] Is Null,"EMPTY",UCase([Created By User Name])) & " - " & [Created By User Type], IIf([Converted By User Name] Is Null,"EMPTY",UCase([Converted By User Name])) & " - " & [Converted By User Type], QuotesFile.[Creation Date], LCase([Created By User]) & " - " & [Created By User Type]
HAVING (((QuotesFile.Theater)=[Forms]![frmDataAnalysis]![cboTheater]) AND ((QuotesFile.Country)=[Forms]![frmDataAnalysis]![cboCountry]));
VBA Code
Public Sub PivotTableExportData()
Dim xlapp As Excel.Application
Dim xlwb As Excel.Workbook
Dim xlws As Excel.Worksheet
Dim adors As ADODB.Recordset
Dim x As Long
Set xlapp = New Excel.Application
xlapp.Visible = True
Set xlwb = xlapp.Workbooks.Add
Set xlws = xlwb.Worksheets(1)
xlws.Name = "RawData"
Set adors = New ADODB.Recordset
adors.Open "qryPivotbyPartner", CurrentProject.Connection, adOpenStatic, adLockReadOnly
For x = 1 To adors.Fields.Count
xlws.Cells(1, x) = adors.Fields(x - 1).Name
Next
xlws.Cells(2, 1).CopyFromRecordset adors
adors.Close
Set adors = Nothing
xlwb.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=xlws.Name & "!" & _
xlws.Cells(1, 1).CurrentRegion.Address).CreatePivotTable TableDestination:="", _
tableName:="PivotTable2", DefaultVersion:=xlPivotTableVersion10
xlapp.ActiveSheet.PivotTableWizard TableDestination:=xlapp.ActiveSheet.Cells(3, 1)
xlapp.ActiveSheet.Cells(3, 1).Select
With xlapp.ActiveSheet.PivotTables("PivotTable2")
'.AddFields RowFields:=Array("Customer Name", "Created by", "Converted by"), PageFields:="Created By User Type"
.AddFields RowFields:=Array("Customer", "Data"), PageFields:="Created By User Type"
'.AddFields RowFields:=Array("Created by", "Data")
'.AddFields RowFields:=Array("Converted by", "Data")
'.AddFields PageFields:=Array("Created By User Type", "Creation Date")
'.AddFields RowFields:=Array(, "Data"), PageFields:="Country", PageFields:="Created By User Type"
'.Selection.ShowDetail = False
'.AddFields RowFields:=Array("Created by", "Data"), PageFields:="Country", PageFields:="Created By User Type"
'.AddFields RowFields:=Array("Customer", "Data"), PageFields:="Country"
'.Name = "Verdana"
'.Size = 8
With .PivotFields("CSCC-Q")
.Orientation = xlDataField
.Caption = "Number CSCC-Q"
.Position = 1
.Function = xlCount
End With
With .PivotFields("CSCC-Q-V")
.Orientation = xlDataField
.Caption = "Total CSCC-Q-V"
.Position = 2
.Function = xlSum
.NumberFormat = "$#,##0.00"
End With
With .PivotFields("IQT-Q")
.Orientation = xlDataField
.Caption = "Number IQT-Q"
.Position = 3
.Function = xlCount
End With
With .PivotFields("IQT-Q-V")
.Orientation = xlDataField
.Caption = "Total IQT-Q"
.Position = 4
.Function = xlSum
.NumberFormat = "$#,##0.00"
End With
With .PivotFields("SCC-Q")
.Orientation = xlDataField
.Caption = "Number SCC-Q"
.Position = 5
.Function = xlCount
End With
With .PivotFields("SCC-Q-V")
.Orientation = xlDataField
.Caption = "Total SCC-Q-V"
.Position = 6
.NumberFormat = "$#,##0.00"
End With
With .PivotFields("CSCC-O")
.Orientation = xlDataField
.Caption = "Number CSCC-O"
.Position = 7
.Function = xlCount
End With
With .PivotFields("CSCC-O-V")
.Orientation = xlDataField
.Caption = "Total CSCC-O-V"
.Position = 8
.NumberFormat = "$#,##0.00"
End With
With .PivotFields("IQT-O")
.Orientation = xlDataField
.Caption = "Number IQT-O"
.Position = 9
.Function = xlCount
End With
With .PivotFields("IQT-O-V")
.Orientation = xlDataField
.Caption = "Total IQT-O"
.Position = 10
.NumberFormat = "$#,##0.00"
End With
With .PivotFields("SCC-O")
.Orientation = xlDataField
.Caption = "Number SCC-O"
.Position = 11
.Function = xlCount
End With
With .PivotFields("SCC-O-V")
.Orientation = xlDataField
.Caption = "Total SCC-O-V"
.Position = 12
.NumberFormat = "$#,##0.00"
End With
'With .PivotFields("OAR %")
' .Orientation = xlDataField
' .Caption = "% Orders-Adoption"
' .Position = 13
'.NumberFormat = "$#,##0.00"
'End With
With .DataPivotField
.Orientation = xlColumnField
.Position = 1
End With
End With
xlapp.ActiveSheet.Name = "Pivot-Data"
Set xlws = Nothing
Set xlwb = Nothing
Set xlapp = Nothing
MsgBox "Done"
End Sub
|