Date Format

Moxioron

Active Member
Joined
Mar 17, 2008
Messages
436
Office Version
  1. 2019
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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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
 
Upvote 0
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.
 
Upvote 0
You will most likely need to use the whole expression again, in the new calculation. Access generally doesn't store those intermediate results.

Denis
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

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
Back
Top