[AccessD] Date Format Not Working
Rocky Smolin
rockysmolin at bchacc.com
Sat Jun 27 22:46:05 CDT 2015
But the solutions didn't work. So I'm using Long Date format instead of the
client's custom format.
So with Bill's help 2 functions - one that returns string and one that
returns date.
Private Function GetDate(argDate As String) As String
GetDate = CDate(Right(argDate, Len(argDate) - InStr(1, argDate, ", ")))
End Function
Private Function GetDate2(argDate As String) As Date
GetDate2 = CDate(Right(argDate, Len(argDate) - InStr(1, argDate, ", ")))
End Function
So wherever I need mm/dd/yyyy I call the function.
Thank you Dr Benson.
r
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Stuart McLachlan
Sent: Saturday, June 27, 2015 3:55 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Date Format Not Working
Alhzeimers?
Asked and answered 10 days ago
<quote>
On 17 Jun 2015 at 16:17, Rocky Smolin wrote:
> Dear List:
>
> Access 2003 - VBA
>
> Is there a function that will convert a date in a text box formatted
> ddd d-mmm-yyyy (Fri 12-JUN-2015) to short date (mm/dd/yyyy) format?
>
> MTIA
>
> Rocky Smolin</quote>
and the solutions:
Datevalue doesn't like the ddd part so you need to strip it. This works:
Format(datevalue(mid$("Fri 12-JUN-2015",5)),"mm/dd/yyyy")
and
If it is an actual date field in a textbox, explicitly use txtSomeDate.Value
rather than txtSomeDate or txtSomeDate.Text
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list