I have an unbound textbox that I want to have part of it be a dollar amount, but it isn't working. Here is the code in textbox: - ="* " & [NumToGetSpecialRate] &
-
Switch([NumToGetSpecialRate]=1,"st",[NumToGetSpecialRate]=2,"nd",[NumToGetSpecialRate]=3,"rd",[NumToGetSpecialRate]>=4,"th") &
-
" file of same month " &
-
CCur([SpecialRate])
The last line, CCur([SpecialRate]) should give a dollar amount, but it isn't. I get just a number with no decimal. It does return the correct number, just not as a dollar amount. For example, one record returns this value * 3rd file of same month 12, but I want to be * 3rd file of same month $12.00.
Does CCur() work with variables but not with fields? Is there a better way to do this?
CCur() is working perfectly as expected. It converts the argument to a Currency value. Of course, as soon as you add that Currency value to the end of the string it is automatically re-converted to string in the standard way, which does not include determining a format string from the type of the value it used to be. Does that make sense?
What you need to do here is to use the Format() function to prepare the string representation of your value : - ='* ' & [NumToGetSpecialRate] &
-
Switch([NumToGetSpecialRate]=1,'st',[NumToGetSpecialRate]=2,'nd',[NumToGetSpecialRate]=3,'rd',[NumToGetSpecialRate]>=4,'th') &
-
' file of same month ' &
-
Format([SpecialRate],'Currency')
3 5321 NeoPa 32,556
Expert Mod 16PB CCur() is working perfectly as expected. It converts the argument to a Currency value. Of course, as soon as you add that Currency value to the end of the string it is automatically re-converted to string in the standard way, which does not include determining a format string from the type of the value it used to be. Does that make sense?
What you need to do here is to use the Format() function to prepare the string representation of your value : - ='* ' & [NumToGetSpecialRate] &
-
Switch([NumToGetSpecialRate]=1,'st',[NumToGetSpecialRate]=2,'nd',[NumToGetSpecialRate]=3,'rd',[NumToGetSpecialRate]>=4,'th') &
-
' file of same month ' &
-
Format([SpecialRate],'Currency')
That does make sense. Thanks, and it works perfectly.
NeoPa 32,556
Expert Mod 16PB Sign in to post your reply or Sign up for a free account.
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: DaveA |
last post by:
I am attempting to have an entry on a form that will format the entry
to a currency amount.
For example, if the user types 3452, I would like the form to
store/display 34.52.
If the user...
|
by: Tim Roberts |
last post by:
It looks to me like the handling of the currency type in an ADODB
connecction from Python is broken. Currency data in an Access database is
stored as a 64-bit integer, scaled by 10000. In an...
|
by: Julia Soare |
last post by:
Hello all,
I am trying to display a currency field from an access db on an ASP
page. The only problem i found is that if there is a 0 (zero) after
the decimal i.e. 79.60 it is not displayed.
...
|
by: Mukesh Kumar |
last post by:
hi
I am trying to pass range parameters to crystal reports from my .net environment. The start and end values of the range parameters are of currency type. I need to convert the number to currency...
|
by: Dalan |
last post by:
Is there any code available to address currency rounding problems in
Access 97? Apparently, selecting currency type table fields does not
resolve the problem. For instance, in my form I have a...
|
by: J.J. |
last post by:
Hi,
i have in my table/form two fields, first is number_field(decimal) and
second is combo with two values from other table(USD and EURO). now i want
that after i select USD the number_field is...
|
by: Chris |
last post by:
Hi all,
I'm wanting to divide a currency total in half but can't think of a way
of doing it. The idea is to split a profit text box in two therefore
showing 2 amounts which add up to the total...
|
by: Steven Smith |
last post by:
Hi,
I'm trying to write a simple program to print invoices for people I do work
for. I've got a form with textboxes for descriptions and amounts for items,
and some code for printing the...
|
by: dbfrey |
last post by:
This is the oddest thing I've ever seen.
We have an aspx page with some user controls, one is a main, another is
a status, which has an edit button.
on the main control, we have some dropdowns...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |