Solved

Showing decimal format in Text Field  - VB Script

Posted on 2004-04-30
5
295 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
Comment Utility
Test_Fields("TS_USER_09").Value = FormatNumber(verNum2, 1)

S
0
 
LVL 19

Expert Comment

by:Shauli
Comment Utility
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
Comment Utility

Or:

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

bukko
0
 
LVL 19

Expert Comment

by:Shauli
Comment Utility
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
Comment Utility

So, what is truth anyhow?

bukko
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now