473,434 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Problems with Converting Text to Currency

I would appreciate anyone's assistance to sort out what change in code
is needed for 'TextToDigits()' as shown below. The function does
convert the text to numbers, but it is two decimals off, i.e., 26500
($265.00) is converted to $26,500.00. Thanks for your time.

Rolan
Function XlateDigit(ByVal C As String) As String
C = UCase(C)
Select Case C
Case "X"
XlateDigit = 0
Case "C"
XlateDigit = 1
Case "R"
XlateDigit = 2
Case "W"
XlateDigit = 3
Case "H"
XlateDigit = 4
Case "E"
XlateDigit = 5
Case "K"
XlateDigit = 6
Case "L"
XlateDigit = 7
Case "G"
XlateDigit = 8
Case "T"
XlateDigit = 9
Case Else
XlateDigit = 0
End Select
End Function

Function TextToDigits(ByVal Cost As Variant) As Variant

Dim I As Currency

If VarType(Cost) = 8 Then
For I = 1 To Len(Cost)
Mid(Cost, I, 1) = XlateDigit(Mid(Cost, I, 1))
Next I
End If

TextToDigits = Cost

End Function

Nov 13 '05 #1
2 1687
Rog
What a strange function...
If you're sure the input always contains cents you could change the
last line to TextToDigits = Cost / 100

Nov 13 '05 #2
"Rolan" <co******@safe-mail.net> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
I would appreciate anyone's assistance to sort out what change
in code is needed for 'TextToDigits()' as shown below. The
function does convert the text to numbers, but it is two
decimals off, i.e., 26500 ($265.00) is converted to
$26,500.00. Thanks for your time.

Rolan


Purely as an excercise in cryptography, try

TextToDigits = Cost/100
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nico den Boer | last post by:
Hi all, I'm working with: MySql: Database server: mysql-4.1.7-essential-win ODBC driver: MyODBC-3.51.10-x86-win-32bit Administrator: mysql-administrator-1.0.14-win Query browser:...
0
by: Marcelo López | last post by:
Hello everybody. I'm working with an office pivot table and i have to convert from its currency type to a decimal (in C#) , operate with the result and then re-convert it to the currency type to...
6
by: Newbee Adam | last post by:
I have been reading in help how I need to use decimal becuase currency does not exist like I used in vb6. I had a difficult time on google and msdn finding how or if I can take the value of text...
2
by: RC | last post by:
I am getting input from a digital scale and if the weight on the scale is 9.25 pounds, the input looks like: 009.25LB I need to remove the LB and the leading zeros and have the remaining value...
0
by: Marcelo López | last post by:
Hello everybody. I'm working with an office pivot table and i have to convert from its currency type to a decimal (in C#) , operate with the result and then re-convert it to the currency type to...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
4
by: chengsi | last post by:
I have based a report on a crosstab query. This query has eliminated all formats, i.e. all fields including those containing numbers are now stored as text. Is there a way that i can get Access...
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
11
by: ajos | last post by:
I have to apply a format to my currency value. The currency i have is--> 1402000 15000 10000 and so on. I want to display it as---> 14,02,000 15,000
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.