Solved

Showing decimal format in Text Field  - VB Script

Posted on 2004-04-30
5
299 Views
Last Modified: 2010-05-02
Hi

The Test_Fields("TS_USER_09").Value  should show me as 3.0 when there is a 3

When we try it with a value as 3.1 it shows correctly as we want as 3.1

Is there any function where we can show a text field as 3.0 when it is only just a number like say 3 ?

 if (FieldName = "TS_STATUS") and (Test_Fields("TS_STATUS").Value = "Baselined")Then
         Test_Fields("TS_USER_09").IsReadOnly = False
                     verNum1  = CDbl(Test_Fields("TS_USER_09").Value)
                     verNum2  = Fix(verNum1)
                     verNum2  = verNum2 + 1.0

         Test_Fields("TS_USER_09").Value = cstr(verNum2)
         Test_Fields("TS_USER_09").IsReadOnly = True
       end if
0
Comment
Question by:Richards
  • 3
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 100 total points
ID: 10959400
Test_Fields("TS_USER_09").Value = FormatNumber(verNum2, 1)

S
0
 
LVL 19

Expert Comment

by:Shauli
ID: 10959426
ps. where  the number 1 in the function FormatNumber("expression", 1) is the number of decimal places you want to display. If you set it to 2, then it would show 3.00, or 4,10 etc...

S
0
 
LVL 8

Expert Comment

by:bukko
ID: 10959589

Or:

Test_Fields("TS_USER_09").Value = Format( verNum2, "0.0" )

bukko
0
 
LVL 19

Expert Comment

by:Shauli
ID: 10959617
bukko,
That is not always true, as formatnumber takes the decimal separator from the system locale, because in some languages the decimal separator is a dot and in others its a comma. So going with 0.0 can be true only in those locales which use dot as a separator.

S
0
 
LVL 8

Expert Comment

by:bukko
ID: 10959759

So, what is truth anyhow?

bukko
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question