Date Format

Moxioron

Active Member
Joined
Mar 17, 2008
Messages
422
Hello all.

I have a date that I import that is formatted YYYYMMDD. So I created a query with this SQL:

Time Period: Left([Time Period Code],4) & "/" & Mid([Time Period Code],5,2) & "/" & Right([Time Period Code],2)

Then I used Date Formatted: Format(CDate([Time Period]),"mm/dd/yyyy") and the date now appears as MM/DD/YYYY like I want it to.

However, when I use Between[Start Date]AND[End Date] in the criteria I get the message "You tried to execute a query that does not include the specific expression ...... as part of an aggregate function".

I need to be able to query by date range. Any suggestions? Thanks.
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
That's nothing to do with the date format; sounds like you have a totals query and the date expression is not set up as Group By.

Denis
 

Moxioron

Active Member
Joined
Mar 17, 2008
Messages
422
Even by changing it to a Group By .... I don't get the desired results.

When you have a date that was obtained from an expression, how does one query between two dates? Thanks.
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
You will most likely need to use the whole expression again, in the new calculation. Access generally doesn't store those intermediate results.

Denis
 

Watch MrExcel Video

Forum statistics

Threads
1,132,914
Messages
5,655,930
Members
418,253
Latest member
TheJackal26

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
Top