Hello all! I'm having the oddest issue trying to format a numeric
string as currency without decimals. For instance...
strSalary = "120000.56"
strSalary = Format(strSalary, "$#,##0")
'this one returns "$#,##0" literally, no number
strSalary = Format(strSalary, "C0")
'this one returns "C0" literally, no number
strSalary = Format(strSalary, "currency")
'this one actually formats the number as currency, but is has decimal
places! So close, yet so far...
Am I missing something????
Thanks you,
Cory 2 1563
In order for Format to work the way you want, you must pass in a
numeric type not a string. strSalary = Format(strSalary, "$#,##0") 'this one returns "$#,##0" literally, no number
Dim dSalary as Decimal = 120000.56
strSalary = Format(strSalary, "$#,##0") cr********@gmail.com wrote: Hello all! I'm having the oddest issue trying to format a numeric string as currency without decimals. For instance...
strSalary = "120000.56"
strSalary = Format(strSalary, "$#,##0") 'this one returns "$#,##0" literally, no number
strSalary = Format(strSalary, "C0") 'this one returns "C0" literally, no number
strSalary = Format(strSalary, "currency") 'this one actually formats the number as currency, but is has decimal places! So close, yet so far...
Am I missing something????
Thanks you, Cory
Thank you! That's exactly what I needed to know. I simply wrapped the
string variable in the CDbl function and it worked perfectly. I'd
thought you could format strings as numbers so long as the characters
were all numeric such as with the "currency" type.
strSalary = Format(CDbl(strSalary), "C0")
Thanks again! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bill Stanard |
last post by:
I have had no success using the format function as follows (the two
lines of code run one after the other):
'displays a running total of lblAmtdue.Caption
'contents in txtTotal.Text...
|
by: Patrick J. Schouten |
last post by:
I am new to ASP/VBScript and I am trying to format a texbox when a
user exits it. In Visual Basic you could put the following in the Exit
property of the textbox:
textbox1 = Format(textbox1,...
|
by: Dalan |
last post by:
This should not be an issue, but it is. I'm sure that someone knows
what little piece of code is needed too persuade Access 97 to include
a currency format for labels (Avery, mailing type). Have...
|
by: Mike MacSween |
last post by:
This looks like a bug to me.
I have an expression on a report:
=Format(Sum((**)*(/)),"0.00")
Score is byte
PercentOfGrade is double
PropDegree is single
ModuleCats is byte
|
by: DD |
last post by:
I have a UnionQry that is run from StatementsI and StatementP.
the Due and Paid colunms are currency and show the $
however when i union the two the currency format has gone.
Any help please...
|
by: J.B |
last post by:
I have a datagrid that will display different datasets, (it runs
different sprocs based on a value in the querystring) but it will
always return 6 columns. The 5th and 6th columns are always Date...
|
by: D. Shane Fowlkes |
last post by:
I have a DataItem in a Template that calls a Function to perform a
calculation. The Function returns a decimal value. Easy enough. It looks
like this:
<code>
<%#...
|
by: Parveen |
last post by:
This is a pretty simple issue to solve...but i can't seem to figure it out!!
I want data in some columns to show as currency so I set the format
of a column to currency through code by
...
|
by: Alexio |
last post by:
Am new to javascript.
I need to format the currency in the as numbers are entered in textboxes. I can format the currency in the calculations and display in the totals but can not figure out how to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |