Hi,
I have got a field with numbers in it, which access automatically reads as text (it is a linked CSV text file). One example of a record in this field is -9.99999999999801E-03, when I do - Format((Cdbl("-9.99999999999801E-03")),"#.##")
I get the answer as -.01, which should actually be -9.99.
Also if I had a number such as 3 if I did the same format command on it, i see '3.' instead of '3.00' can this be fixed? Maybe it doesn't even matter.
Thanks
8 20121 FishVal 2,653
Recognized Expert Specialist @iheartvba
I don't see what is wrong here.
Also if I had a number such as 3 if I did the same format command on it, i see '3.' instead of '3.00' can this be fixed? Maybe it doesn't even matter.
Thanks
Use "0" instead of "#" in format string where you want to force zeroes.
To read comprehensive help about it open any table in design view, go to format property of any field and hit F1.
Hi Fishval,
Thanks for the quick response. - Format((Cdbl("-9.99999999999801E-03")),"#.##")
Should this not return -9.99?
or does the E-03 move it 3 decimal places to the left?
I don't know why it's showing the E-03
Sorry If I'm confusing you. Sometimes the challenge is actually articulating the question, so thanks for your patience with me, as always
FishVal 2,653
Recognized Expert Specialist
Sorry iheartVBA, Fish is rightly pointing out that it is you that is wrong in this case! The E notation tells us that the number is presented in a form of scientific notation, where numbers are represented by decimals to a particular power, as explained in detail in the Wikipedia link Fish provided.
In this case -9.99999...E-03 means -9.99999... * 10^(-3) = -0.0099999... which will round to -0.01 when displayed to two decimal places.
There is no problem at all here, at least not with Access or the CSV anyway...
-Stewart
NeoPa 32,556
Recognized Expert Moderator MVP
In case you were wondering, the second part of the question is also explained in the second part of post #2.
I suspected that about E being for exponent. It must be me doing some incorrect calculation. I couldn't see the Wikipedia link, that FishVal provided. Also with regards to my second question, I just tried it out and using 0 instead of # will give a 0 if there is no preexisting number there.
Many Thanks
NeoPa 32,556
Recognized Expert Moderator MVP
When formatting, # is generally just a place-holder. #,##0.00 specifies that digits be grouped in blocks of three with a comma (,) separating. The zero (0) before the dot (.) indicates to display that digit even if zero. - 1234567.89 ==> 1,234,567.89
-
.123456789 ==> 0.12
To show more digits (if available) after the decimal point, add hashes (#,##0.00########). - .123456789 ==> 0.123456789
Thanks guys. You have been a great help (as always)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ike |
last post by:
Does anyone know where I can find example scritp for formatting text input?
I want to have a text box where only legitiamte filesname under unix can be
netered (no whitespace, only alphanumeric,...
|
by: msmcg |
last post by:
I need to format the data in some textboxes using the
Binding method with custom Currency and ShortDate format
and parse handlers.
Here is the code that I am using. I call it on the form
load...
|
by: CJ |
last post by:
This is a really silly question, but I just can't get it right.
I have a double; the value is 0.00003025. I want to display it exactly
as it stands, but by default it is displayed in scientific...
|
by: gsb58 |
last post by:
Hi!
In my application I save text from a RichText box to file, but when
previewing the text it turns out like:
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Verdana;}}...
|
by: korund |
last post by:
We can use special characters ('\n') to add line breaks in text in
JavaScript popup Alert boxes.
there is also few additional special characters:
\' single quote
\" double quote
\&...
| |
by: michael sorens |
last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a
very simple task but I cannot find information on this. I am using a
RichTextBox as an output window. Some text I want to...
|
by: Glen |
last post by:
Hello again, I don't blame anyone for not answering my last post, since I
obviously hadn't spent much time researching, but I've come a little ways
and have another question.
How can I better...
|
by: drfreaky |
last post by:
Hello,
I want to use a richtextbox for logging status messages. I have three kind of message types and want to use different formatting for them.
My problem is, I change the color, add the text...
|
by: raylopez99 |
last post by:
Refer to Int32.TryParse method: http://msdn.microsoft.com/en-us/library/zf50za27.aspx
if you have to, specifically this example:
numericString = "10345.72"
styles = NumberStyles.Integer Or...
|
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,...
|
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...
| |
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,...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |