Numbers to Text for cheques (1 Viewer)

Beady

Registered User.
Local time
Today, 10:30
Joined
Dec 18, 2000
Messages
24
How do I get a cheque to be printed with the amount shown as separate words, ie change £135 to be one hundred, three tens and five pounds?
 

S

Registered User.
Local time
Today, 11:30
Joined
Feb 17, 2000
Messages
33
Hy beady, try this code:
Dim Que As String
Que = Left([FieldName], 3) & " hundred, " & Left([FieldName], 2) & " tens and " & Left([FieldName], 1) & " pounds"
MsgBox Que

If you want to be more accurate you can use Select case option to discriminate between 1 hundred and 2 or 3 hundreds, or to manage 0 hundred

Copy Que in your Text field; Bye, S.
 

S

Registered User.
Local time
Today, 11:30
Joined
Feb 17, 2000
Messages
33
Sorry Beady, there was a mistake; the function you nedd is "Mid" and not "Left":
Dim Que As String
Que = Mid([FieldName], 1, 1) & " hundred, " & Mid([FieldName], 2, 1) & " tens and " & Mid([FieldName], 3, 1) & " pounds"
MsgBox Que
This code works if you have always hundreds; you need select case options to manage different cases:
Select Case Len(FieldName)
Case 3
Que = Mid([FieldName], 1, 1) & " hundred, " & Mid([FieldName], 2, 1) & " tens and " & Mid([FieldName], 3, 1) & " pounds"
Case 2
Que = Mid([FieldName], 1, 1) & " tens and " & Mid([FieldName], 2, 1) & " pounds"
End Select

Hope this helps You, Bye
 

Users who are viewing this thread

Top Bottom