Default date to 1st day of the Month

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.
 
F

fredg

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)
 
F

fredg

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)
 
T

Tim Ferguson

=?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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top