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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Pivottable by vba not working

Status
Not open for further replies.

CWalsh87

Technical User
Dec 15, 2010
16
0
0
Hi,

I'm using the following code to sort a pivottable:

Code:
Me.subfrmDeliveries.Form.PivotTable.ActiveView.FieldSets("Prom Date").Fields("Prom Date").SortDirection = plSortDirectionAscending

I'm happy the code is correct, but the pivottable is not sorting correctly, it's sorting by the "PO Number" (First field in the Pivot table)

The "Prom Date" is in date format and no matter what I do the Pivottable sorts by the "PO Number" field instead

Can anyone help please?

Cheers
Chris
 
Please paste a representative sample of the sort results.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Here's an example
_______________FZ7442____|___FZ7448___|___FZ7456__|
_____________|_13/04/12__|__12/04/12__|__13/04/12_|
Part Number__|
12345________|__100______|_____100____|____100____|

The FZ numbers are the order numbers.

It should be sorting like:

_______________FZ7448____|___FZ7442___|___FZ7456__|
_____________|_12/04/12__|__13/04/12__|__13/04/12_|
Part Number__|
12345________|__100______|_____100____|____100____|

Hope this helps

Cheers
Chris
 

I would guess that your 'dates' are being sorted as STRINGS.

To verify, right-click the date field icon in the PT and select GROUP and report what options you have.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top