Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

create calender code

0 views
Skip to first unread message

balu

unread,
Nov 18, 2007, 8:54:01 AM11/18/07
to
is their any code which can create an TABLE / QUERY containing all the days
of the
current year like from 1/1/07 to 31/12/07 and
1/1/08 to 31/12/08 on next year and so on,,

John Spencer

unread,
Nov 18, 2007, 9:14:33 AM11/18/07
to
Query method would require an auxiliary table with one field containing
the numbers 1 to 366 (0r more).

SELECT DateSerial([TheYear],1,NumberField)
FROM tblNumbers
WHERE NumberField <= 365 + ABS(IsDate([TheYear] & "/02/29"))

If you always want the current year

SELECT DateSerial(Year(Date()),1,NumberField)
FROM tblNumbers
WHERE NumberField <= 365 + ABS(IsDate(Year(Date() & "/02/29"))

VBA to build a table and populate it would be a bit more complex

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

Stuart McCall

unread,
Nov 18, 2007, 4:31:14 PM11/18/07
to
"John Spencer" <spe...@chpdm.umbc> wrote in message
news:%23hMza1e...@TK2MSFTNGP05.phx.gbl...

Neat answer. I especially liked the ABS(IsDate( thing. Simple & elegant.

Tony Toews [MVP]

unread,
Nov 18, 2007, 7:41:15 PM11/18/07
to
balu <ba...@discussions.microsoft.com> wrote:

Why? What is the objective or problem? Maybe we can suggest an
alternative?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

balu

unread,
Nov 19, 2007, 11:08:09 AM11/19/07
to
dear sir
my problom the need for the complete calender of the year is i want to join
date fields with the other table having date field so that i will get the
each and every date between the two said dates i n detail
table issues
issueid , issues issueddate
in select query it will give the dates of issues where the issues are there
but iwant in such a way that all the dates of the months also needed and the
issues are availble aginest such date hence i jined issues yable with
onlydates table
any other way please advise
0 new messages