Solved

String to number

Posted on 2004-09-06
4
170 Views
Last Modified: 2010-05-02
Hi:
     Given the following string :

"$80.00"

I need to add this string to a number. I have tried using the Val function but I get a zero because of the dollar sign. Is there another function or procedure that I could use to covert the string to a number?

0
Comment
Question by:LearningJava
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
mladenovicz earned 400 total points
ID: 11990978
try
val(Replace("$80.00","$",""))
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11990999
also, you can try CCur("$80.00")
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11991061
Oops I meant Cint("$80.00")
0
 
LVL 14

Expert Comment

by:aelatik
ID: 11991197
You could use FormatNumber ( It will handle the decimals correctly that way )

x = FormatNumber("$80.50", 2) ' the 2 stands for nums after digit
MsgBox x
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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

20 Experts available now in Live!

Get 1:1 Help Now