Results 1 to 3 of 3
  1. #1
    sanbhau is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2016
    Posts
    7

    Conversion Date to Words


    I have two fields in the a table. These two fields are Emp_ID and DateOfBirth. The DateOfBirth field is formatted as medium date. I want to convert these dates into words such as 18-Apr-1960 into Eighteenth April, Nineteen hundred and sixty in corresponding query.

    Please guide me in as simple terms as possible considering my lower skill level.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,444
    think you will need a UDF (User Designed Function) to combine data from a lookup tables

    alternatively you could adapt this code

    https://support.microsoft.com/en-us/kb/213360

    Returning to my suggestion the table would look like this

    tblDatestxt
    Num....DayTxt.........YearTxt
    1.........First............One
    2.........Second........Two
    ...
    ...
    19.......Nineteenth...Nineteen
    ...
    ...
    60.......""...............Sixty
    61.......""...............Sixty One

    all the way up to 99 - obviously DayTxt would be blank after 31

    then a UDF (put in a module with a different name to the function)

    Code:
    Option Compare Database
    Option Explicit
    
    Public Function DateToTxt(Target as Date) as String
    Dim Datetxt as string
    
        Datetxt=dlookup("Daytxt","tbleDatestxt","[Num]=" & day(target)) 'add day
        Datetxt=Datetxt & " " &  format(target,"mmmm") 'add month
        Datetxt=Datetxt & ", " & dlookup("Yeartxt","tbleDatestxt","[Num]=" & left(year(target),2)) 'add first part of year
        Datetxt=Datetxt & " hundred and " & dlookup("Yeartxt","tbleDatestxt","[Num]=" & right(year(target),2)) 'add second part of year
    
        DateToTxt=Datetxt
    
    End Function
    You may need a third column in the table if you don't like 'twenty one hundred and sixteen', but for you to play around with

  3. #3
    sanbhau is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2016
    Posts
    7
    thanks for helping my problems have been sorted out.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Converting Date in Words
    By sanbhau in forum Programming
    Replies: 2
    Last Post: 04-21-2016, 05:37 AM
  2. Date Conversion through Update Query
    By Steven.Allman in forum Queries
    Replies: 8
    Last Post: 01-30-2013, 01:38 PM
  3. Date Conversion
    By mslenker in forum Access
    Replies: 1
    Last Post: 01-30-2013, 09:52 AM
  4. Date Conversion
    By mkc80 in forum Access
    Replies: 1
    Last Post: 06-27-2012, 04:04 PM
  5. Access VBA - date format conversion
    By benattal in forum Programming
    Replies: 3
    Last Post: 12-22-2008, 10:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums