Solved

Showing decimal format in Text Field  - VB Script

Posted on 2004-04-30
5
297 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

821 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