Default date in next august? (1 Viewer)

George-Bowyer

Registered User.
Local time
Today, 08:58
Joined
Dec 21, 2012
Messages
177
Hello,

I have a club where people start in positions of office on the 1st of August each year.


I want to put a default date in fldStartDate of the following 1st August.


I can almost do this with DateSerial - but I'm struggling with the year.

From January to July, the start date will be 1st August of the Current year and from August to December, the start date will be 1st August of the following year.

Do I have to do a clumsy IF or select case clause on the month to set the year as Date() or Date()+1?

I feel as if there should be a neater way to automatically get to the next
1st August?

Many thanks,

George
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:58
Joined
May 7, 2009
Messages
19,230
if you are putting the default value in table design:

DateSerial(Switch(Month(Date())>7,Year(Date())+1,True,Year(Date())),8,1)
 

George-Bowyer

Registered User.
Local time
Today, 08:58
Joined
Dec 21, 2012
Messages
177
There's an errant space in the word "true" but this seems to do the job so far.

Will have to wait until Jan 1st to find out if the 2nd half works though... :)

Thanks.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:58
Joined
May 7, 2009
Messages
19,230
for a test, you can advance the Date of your computer.
 

Gasman

Enthusiastic Amateur
Local time
Today, 08:58
Joined
Sep 21, 2011
Messages
14,238
There's an errant space in the word "true" but this seems to do the job so far.

Will have to wait until Jan 1st to find out if the 2nd half works though... :)

Thanks.

Or you could even just put it in the immediate window and change date() to #02/01/2018#
 

Users who are viewing this thread

Top Bottom