Getting a simple date list

RichardMGreen

Well-known Member
Joined
Feb 20, 2006
Messages
2,177
Hi all

I want to use a simple query to get a list of dates for the last 365 days.
I've tried to create it using a Select query but Access is complaining that I have no table or query selected.

It's straight-forward in SQL as you can do a simple Select without a From.

Anyone any ideas on how this can be done?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Richard

How did you try it in Access?
 
Upvote 0
I did a simple select to get date where the date was between today-366 and today.
The SQL was :-
SELECT Date() AS Dates
WHERE (((Date()) Between Now()-366 And Now()));

but it gives me an error because the query doesn't contain a table or another query.

I've used a table full of dates for the time being.
 
Upvote 0
Richard

Even if that query had worked it would only have repeated the same date over and over.

Even in 'proper' SQL you can't use a simple SELECT statement to get the dates.

I think some versions do have ways of doing it but most of them seem to use some sort of procedure or other method.

I have seen some examples using what appears to be very advanced SQL but I think they also use some database-specific methods.

When I need this sort of thing I just goto Excel to create the dates and copy them to Access.

Not ideal but it works.:)
 
Upvote 0
I've created a table to use for the time being and future proofed it for a few years.
I just wondered if I was going wrong somewhere.

Thanks for your time anyway.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

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