Hi,
I'm trying to write an OnExit event procedure so that if the date in the TxtStart field is 01/01 of any year, then the TxtEnd field will automatically show 12/31/ of that year.
Or else, TxtEnd field will automatically show the last day of the month/year for the TxtStart month/year.
I can't figure out how to write it - the code below is wrong - but maybe someone can help?
If TxtStart=1/1/2005 then TxtEnd=12/31/2005
But
If TxtStart=2/1/2005 then TxtEnd=2/28/2005
same for all the other months.
Thanks very much!!
I'm trying to write an OnExit event procedure so that if the date in the TxtStart field is 01/01 of any year, then the TxtEnd field will automatically show 12/31/ of that year.
Or else, TxtEnd field will automatically show the last day of the month/year for the TxtStart month/year.
I can't figure out how to write it - the code below is wrong - but maybe someone can help?
Code:
Iff(TxtStart=#01/01/AnyYear#,
Me![TxtEnd] = DateSerial(Year(Me![TxtStart]), 11 + Month(Me![TxtStart]), 0),
Me![TxtEnd] = DateSerial(Year(Me![TxtStart]), 1 + Month(Me![TxtStart]), 0)
If TxtStart=1/1/2005 then TxtEnd=12/31/2005
But
If TxtStart=2/1/2005 then TxtEnd=2/28/2005
same for all the other months.
Thanks very much!!