Solved

how to 3.3 to 3.30

Posted on 1998-06-21
3
224 Views
Last Modified: 2010-05-03
A variable displays 3.3 and I want 3.30 or always 2 decimals
0
Comment
Question by:harryq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
dirtdart earned 30 total points
ID: 1463885
You would have to assign the number to a string and check the length after the decimal to be able to do that.

Dim sTemp As String
Dim iTemp As Integer

sTemp = "3.3"

iTemp = InStr(sTemp, ".")

If Len(sTemp) - iTemp < 2 Then sTemp = sTemp & "0"


0
 

Expert Comment

by:murrayw
ID: 1463886
Dim N as single, NOut as string

NOut = Format$(N, "###,##0.00")

                              Murrayw



0
 

Author Comment

by:harryq
ID: 1463887
Both  samples work.

0

Featured Post

Independent Software Vendors: 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

733 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