first and last day of months

dark11984

Registered User.
Local time
Tomorrow, 05:40
Joined
Mar 3, 2008
Messages
129
On my form I have a month Combo Box and a Year combo box. Below that I have two text boxes - Start Date & Finish Date.

When i select the month and year i want the start date to be populated with the first day of the select month/year and the finish date to be populated with the last day of the selected month/year.

If possible i want the month combo box to be displayed in text i.e. "January", "February", etc. the finish date also needs to take into account if it is a leap year February shoudl have 29 days.

I thougth about using the following code on an after update event of the year field btu couldn't get it to work - not even sure if this is the way to go.

Code:
TxtFinDate = DateSerial(Year(CboYear), Month(CboMonth) + 1, 0)
TxtStDate = DateSerial(Year(CboYear), Month(CboMonth), 1)
 
Worked great thanks!
 

Users who are viewing this thread

Back
Top Bottom