473,403 Members | 2,183 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,403 software developers and data experts.

converting string to number without rounding decimals

RC
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 as a number (not a text string). The best solution I
came up with was to use the Left and Right functions to clean up the
string so that it becomes 009.25 BUT it is still a string. I can use
the CCur function to convert it to currency and it looks like 9.25 but
I need to convert Pounds to Kilograms at a later point so the
"currency" may not convert properly.
ALSO, I am plugging the data into a Linked table and I don't know how
to change the linked table field to Currency (if I wanted to do this).
Do I need to unlink the table somehow, then change it and then
re-link the tabel?

Thanks in advance for any help with this. RC
Nov 13 '05 #1
2 6849
Leave it as text in your table and used a query based on the table for calcs
etc.

Use a calculated field in the query:

CDbl(Left([Field],Len([Field])-2))

--
Michael Hopwood
"RC" <rc*********@yahoo.com> wrote in message
news:3c**************************@posting.google.c om...
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 as a number (not a text string). The best solution I
came up with was to use the Left and Right functions to clean up the
string so that it becomes 009.25 BUT it is still a string. I can use
the CCur function to convert it to currency and it looks like 9.25 but
I need to convert Pounds to Kilograms at a later point so the
"currency" may not convert properly.
ALSO, I am plugging the data into a Linked table and I don't know how
to change the linked table field to Currency (if I wanted to do this).
Do I need to unlink the table somehow, then change it and then
re-link the tabel?

Thanks in advance for any help with this. RC

Nov 13 '05 #2
On 30 May 2004 08:46:54 -0700, RC wrote:
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 as a number (not a text string). The best solution I
came up with was to use the Left and Right functions to clean up the
string so that it becomes 009.25 BUT it is still a string. I can use
the CCur function to convert it to currency and it looks like 9.25 but
I need to convert Pounds to Kilograms at a later point so the
"currency" may not convert properly.
ALSO, I am plugging the data into a Linked table and I don't know how
to change the linked table field to Currency (if I wanted to do this).
Do I need to unlink the table somehow, then change it and then
re-link the tabel?

Thanks in advance for any help with this. RC


How about
=Val(YourField])

"0009.25LB" as Text becomes 9.25 (a number)
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #3

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

Similar topics

6
by: Donal McWeeney | last post by:
Hi, Is there a way to specify on the predefined format strings like P and N that you want displayed all the decimals in the number... for example 3 will display 3 2.1 will display 2.1...
4
by: Spufi | last post by:
I have read several messages on converting packed decimals (EBCDIC) in a C++ program, but they were all for AS400 systems. I am looking for a way to convert the packed decimals in a COBOL program...
1
by: pebelund | last post by:
Hi I got an .aspx that got the following code (example) <td width="120"> <% = row %> </td> row takes a value from a SQL db, that is a string of numbers. On the webbsite I want this to show...
52
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
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...
19
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
7
by: Tony Girgenti | last post by:
Hello. Trying to develop VS2005, SP1 windows form VB program. When i try a statement like below and the data is "24.95", without the quotes of course, regPriceString equals "000000000025+" . ...
3
by: nvx | last post by:
Hi, I'm looking for a simple way to convert a Double to a String exactly the .ToString() does, except these two differences: - the number of decimals is given (rounding is applied if necessary),...
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.