sorting date in crosstab query

B

binnie pillai

i have a crosstab query which has the row heading showing the weeks of the
month, the code i have written is
Format(Invoice1.Inv_date-Weekday(Invoice1.Inv_date)+1,'dd-mmm-yy') & ' ' &
Format(Invoice1.Inv_date-Weekday(Invoice1.Inv_date)+7,'dd-mmm-yy')

the problem is it is showing me months in the order feb,oct,mar
13-Feb-05 19-Feb-05
16-Oct-05 22-Oct-05
20-Mar-05 26-Mar-05

how do i sort this query...

cheers bye
 
A

Allen Browne

Since you are sorting on a string value, you will need to sort year, then
month (as a number), then date to get them in order:

Format(Invoice1.Inv_date-Weekday(Invoice1.Inv_date)+1,'yyyy\-mm\-dd') & ' '
& Format(Invoice1.Inv_date-Weekday(Invoice1.Inv_date)+7,'yyyy\-mm\-dd')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top