Convert Numbers to text

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Convert Numbers to text

Post by adam »

Hi Anyone,

I have included a module in my database where I'm trying to convert the numbers into text.

But my formulas aren't working. How could I overcome this?

Any help on this would be kindly appreciated.

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78530
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Covert Numbers to text

Post by HansV »

The cause of the problem is that you have given the code module the same name (ConvertCurrencyToEnglish) as the function you want to use. This confuses Access. You should give the module another name, for example basConvert (but you're free to choose something else).

Moreover, you should add the following at the beginning of the function ConvertCurrencyToEnglish:

Code: Select all

         If IsNull(MyNumber) Then
           Exit Function
         End If
This avoids an error message when the Total text box hasn't been filled yet.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Covert Numbers to text

Post by adam »

Thanks for the help Hans. If I want the currency to another country should it be changed by changing the text such as dollars and cents for example to rupees and paisa or whatsoever
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78530
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Numbers to text

Post by HansV »

If it's OK to use the thousand - million - billion way of counting, it is sufficient to change the text for dollar and for cent within the quoted strings.

It becomes more complicated if you want to use the Indian system of counting, with thousand - lakh - crore.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Convert Numbers to text

Post by adam »

Thanks for the help. How could I make the numbers to appear as decimal places.

Suppose if 3 is written it will appear as 3.00
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78530
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Numbers to text

Post by HansV »

You don't need the convert function for that - simply set the Format property to Fixed.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Convert Numbers to text

Post by adam »

Thanks for the help Hans.
Best Regards,
Adam