date problem

Geoff Codd

Registered User.
Local time
Today, 12:30
Joined
Mar 6, 2002
Messages
190
I'm looking for some code that will automaticall convert the inputted date the last day of the month

Example
User enters 13/03/02 code converts it to 31/03/02

Thanks in advance
Geoff
 
On the after update event of the textbox

Dim MyDate As Date
Dim MyNewDate As Date
MyDate = Me.txtDate
MyNewDate = DateAdd("d", -1, Format("01/" & Format(DateAdd("m", 1, MyDate), "mm/yy"), "dd/mm/yy"))
Me.txtDate = MyNewDate

Might be an easier way, but it does work!!

HTH
 
Thanks Harry it works great in the end i just put in

Me![First Full Billing Month] = DateAdd("d", -1, Format("01/" & Format(DateAdd("m", 1, Me![First Full Billing Month]), "mm/yy"), "dd/mm/yy"))
 

Users who are viewing this thread

Back
Top Bottom