Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 November 29th, 2006, 01:37 PM
Registered User
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exporting dates to Excel

I'm having an issue in Excel 2002 when running a pivottable from date imported from Access 97.

The Access database has some calculated fields in a query which take a date and calculate the week commencing, i've enclosed the formula in the CDate command which ensures the date is formatted as a date.

The Excel spreadsheet imports the data from the database and updates when the file opens and then various pivottables run from this (a workaround to the fact that I produced the Access database in the middle of a project and don't have the time to change all of the reports that ran from the old spreadsheet which is now the database!).

The issue I have is that when in the spreadsheet the dates in the calculated w/c field are definately formatted as dates (I can run formulas on them etc), but when I create a pivottable using this field it sorts them alphabetically rather than in date order (i.e. 01/01/2007, 01/10/2006, 02/11/2006, 02/02/2007..etc), which is irritating at the least. I don't understand why excel is treating this column as a date column for all intents and purposes but as a text column for the pivottable.

I've created another field with the formula DATE(YEAR(BW10),MONTH(BW10),DAY(BW10) and then run the pivottable and sorted by this field and it works just fine, i'm exasperated with this issue as it would seem to be a glitch but I can't find a simple workaround.

Thanks in advance.

 
Old November 30th, 2006, 04:23 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Your work-around is to format the date in the YYMMDD format, so as text or a date this will be sorted correctly.

Lee





Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting to excel michaeltanfeliz Beginning VB 6 2 May 3rd, 2008 05:26 AM
exporting to excel caveatashish Classic ASP Basics 0 November 3rd, 2006 05:08 AM
Exporting to Excel swhite Access VBA 2 September 18th, 2003 09:42 AM
Exporting to Excel JJ Access 1 June 9th, 2003 11:30 AM





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