Need Your Help! How to Convert Date of Birth from Digits to Words (Text) Ms Access?

Copper Contributor

i am beginner dont understand coding very well, i saw a post in which i get code but i dont know it will work or now and i dont know how to use it in VBA. can anybody teach me ?
Like 1/1/2000 First January of Two Thousand

Option Compare Database
Option Explicit

Sub Test()
Dim TestDate As Date
TestDate = CDate("11.04.2013")
Dim dtString As String
dtString = DateInWords(TestDate)

MsgBox (dtString)
End Sub

Function DateInWords(dt As Date) As String
Dim strDays As String, SplitDays
strDays = "Day_1,Day_2,Day_3,Day_4,Day_5,Day_6,Day_7,Day _8,D ay_9,Day_10,Day_11,Day_12,Day_13,Day_14,Day_15,Day _16,Day_17,Day_18,Day_19,Day_20,Day_21,Day_22,Day_ 23,Day_24,Day_25,Day_26,Day_27,Day_28,Day_29,Day_3 0,Day_31"
SplitDays = Split(strDays, ",")
Dim strMothes As String, SplitMonthes
strMothes = "Month_1,Month_2,Month_3,Month_4,Month_5,Month _6,M onth_7,Month_8,Month_9,Month_10,Month_11,Month_12"
SplitMonthes = Split(strMothes, ",")
Dim strYears As String, SplitYears
strYears = "Year_2010,Year_2011,Year_2012,Year_2013,Year_ 2014 ,Year_2015,Year_2016,Year_2017,Year_2018,Year_2019 ,Year_2020"
SplitYears = Split(strYears, ",")

Dim strDay As String
strDay = SplitDays(Day(dt) - 1)
Dim strMonth As String
strMonth = SplitMonthes(Month(dt) - 1)
Dim strYear As String
strYear = SplitYears(Year(dt) - 2010)

DateInWords = strDay & " " & strMonth & ", " & strYear
End Function

4 Replies

That function will not provide you with the result you desire.  For instance, using the Test sub, it returns

 

Day_4 Month_11, Year_2013

 

I'd suggest you look at https://www.extendoffice.com/documents/excel/4694-excel-date-to-words.html as it will give you the format you are seeking.

 

@ZKMPk 

 

I'm not sure since the translation isn't the best, so maybe you're looking for something like that.

 

 

Sub OnlyText()
Dim lngRow As Long
For lngRow = 1 To Cells(Rows.Count, 4).End(xlUp).Row
If Not IsEmpty(Cells(lngRow, 4)) Then
If IsDate(Cells(lngRow, 4)) Then
Cells(lngRow, 4) = Format(Cells(lngRow, 4), "DDDD.MMMM.YYYY")
End If
End If
Next
End Sub

 

 

If you find this helpful, please mark it as "Best Answer" and as Like (click thumbs up), it will be beneficial to more Community members reading here.

 

Nikolino

I know I don't know anything (Socrates)

That's Excel code and this is an Access question/forum.

There are no cells, rows, xlUp, ... in Access.
ups sry wrong forum landed

but if I'm here ... here is a link to help ... if it helps :)

https://codekabinett.com/rdumps.php?Lang=2&targetDoc=date-time-data-type-vba-access

The third-party products that this article discusses are manufactured by companies that are independent of me. I makes no warranty, implied or otherwise, about the performance or reliability of these products.

Thx
Nikolino