Format date in VBA

Danick

Registered User.
Local time
Today, 06:23
Joined
Sep 23, 2008
Messages
375
I'm trying to append a date field to memo field each time the date field is updated. This is to maintain a history. I'm using an after update event on the date field called "lastmeetingdate" and appending the date to a memo field called "meetinghistorydate". Here is the code

Code:
Me!MeetingDateHistory = Me!MeetingDateHistory & vbCrLf & Me.LastMeetingDate

This works fine except that I would like to append the date in a Medium or Long format. Anyone know what code to add to make this happen?
Thanks
 
Well I tried to work the example in your link into my form but I'm still getting the date showing up in the same format that is entered. Any help appreciated.

Code:
Private Sub LastMeetingDate_AfterUpdate()
Dim LastMeetingDate As String
LastMeetingDate = Format(Date, "dd-mmm-yyyy")
Me!MeetingDateHistory = Me!MeetingDateHistory & vbCrLf & Me.LastMeetingDate
End Sub
 
You aren't using the variable, you're still using the textbox. Also, to avoid confusion I wouldn't name them the same. Also, you're formatting today's date, not the date in the textbox.
 
also:

Me!MeetingDateHistory = Format(Me!MeetingDateHistory,"Medium Date") & vbCrLf & Format(Me.LastMeetingDate,"Medium Date")
 
also:

Me!MeetingDateHistory = Format(Me!MeetingDateHistory,"Medium Date") & vbCrLf & Format(Me.LastMeetingDate,"Medium Date")

Thanks arnelgp - that works very well and exactly what I've been trying to do!!
 

Users who are viewing this thread

Back
Top Bottom