Default date to 1st day of the Month

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All.

I would like a text box on a form to display the 1st day of the relevent
month when the form is loaded.

I know how to get the current date i.e, Date() and how to DateAdd and
subtract, but not how to load the 1st day of each month.

Any ideas.
 
Hello All.

I would like a text box on a form to display the 1st day of the relevent
month when the form is loaded.

I know how to get the current date i.e, Date() and how to DateAdd and
subtract, but not how to load the 1st day of each month.

Any ideas.

Which month is the relevant month?
The current month? The next month?

The current month:
=DateSerial(Year(Date()),Month(Date()),1)

The next month:
=DateSerial(Year(Date()),Month(Date())+1,0)
 
Which month is the relevant month?
The current month? The next month?

The current month:
=DateSerial(Year(Date()),Month(Date()),1)

The next month:
=DateSerial(Year(Date()),Month(Date())+1,0)

Whoops,

regarding =DateSerial(Year(Date()),Month(Date())+1,0)
I inadvertently gave you the last day of the current month.
It should have been:
=DateSerial(Year(Date()),Month(Date())+1,1)
 
=?Utf-8?B?c2ViYXN0aWFuIHN0ZXBoZW5zb24=?=
I would like a text box on a form to display the 1st day of the relevent
month when the form is loaded.

firstOfMonth = CDate(someDate - Day(someDate) + 1)


Hope that helps


Tim F
 
Back
Top