Number code

  • Thread starter Thread starter Fred
  • Start date Start date
F

Fred

I am trying to produce payment details on a preprinted
cheque using a report. The value of the cheque is
displayed in the report
and under this I want a separate field(s) with the
individual digits of the number shown in words eg 651,253
to be displayed as 'Six' 'Five' 'One' 'Two' 'Five' 'Three.
I have the code that displays the value as Six Hundred and
Fifty One etc., but this is not what I want.

thanks
 
I am not aware of anything that will do what you ask, I
think you may have to break the number in pieces by using
nested left() and right() funstions. and than address each
digit.
Hope this helps some what.
Fons
-----Original Message-----
I am trying to produce payment details on a preprinted
cheque using a report. The value of the cheque is
displayed in the report
and under this I want a separate field(s) with the
individual digits of the number shown in words eg 651,253
to be displayed
as 'Six' 'Five' 'One' 'Two' 'Five' 'Three.
 
Fred said:
I am trying to produce payment details on a preprinted
cheque using a report. The value of the cheque is
displayed in the report
and under this I want a separate field(s) with the
individual digits of the number shown in words eg 651,253
to be displayed as 'Six' 'Five' 'One' 'Two' 'Five' 'Three.
I have the code that displays the value as Six Hundred and
Fifty One etc., but this is not what I want.

thanks

Fred,

You can write a user defined function to return the individual number as
a text word.

Function Converting(NumIn)
' Convert numbers to their individual word.
Dim strY As String
Dim strString As String
Dim intX As Integer
For intX = 1 To Len(NumIn)
strY = Mid(NumIn, intX, 1)
If strY = "0" Then
strY = "10"
End If
strString = strString & Choose(Val(strY), "One", "Two",
"Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero")

Next intX
Converting = strString
End Function
======
You can call it from a control on a report, or as below, from a query:
TextWords:Converting([NumberField])

Hope this helps.
 
Hi, thanks for that. I copied the code into a new module
in my database. I opened my report and from a control
field entered Converter([value]).

When I ran the report I was moved to the new module with
the first line of the code highlighted.

Function Converting(NumIn)

Am I doing something wrong?
-----Original Message-----
Fred said:
I am trying to produce payment details on a preprinted
cheque using a report. The value of the cheque is
displayed in the report
and under this I want a separate field(s) with the
individual digits of the number shown in words eg 651,253
to be displayed as 'Six' 'Five' 'One' 'Two' 'Five' 'Three.
I have the code that displays the value as Six Hundred and
Fifty One etc., but this is not what I want.

thanks

Fred,

You can write a user defined function to return the individual number as
a text word.

Function Converting(NumIn)
' Convert numbers to their individual word.
Dim strY As String
Dim strString As String
Dim intX As Integer
For intX = 1 To Len(NumIn)
strY = Mid(NumIn, intX, 1)
If strY = "0" Then
strY = "10"
End If
strString = strString & Choose(Val (strY), "One", "Two",
"Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero")

Next intX
Converting = strString
End Function
======
You can call it from a control on a report, or as below, from a query:
TextWords:Converting([NumberField])

Hope this helps.

.
 
Back
Top