Re: How to convert text to number in a query?
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Thu, 10 Aug 2006 10:19:27 +0800
CCur() converts the value into Currency type data. The display of Currency
type defaults to whatever you defined in the Regional Settings of the
Control Panel in Windows.
Queries are reallly just the engine, and not really a display interface. You
normally use a form or report to display the data to the user. The text box
on your form/report has a Format property. You can set that property to
specify the currency format.
The fields in a query do have a Format property too. You can set the
property by opening the properties box (View menu in query design view),
clicking on the field, and setting the property. This works for a saved
query, but obviously does not apply if you are writing SQL strings.
You can use the Format() function to specify a format for a field in a
query. That's suitable for exporting the value, but is not suitable for
working on it within Access, because the results will behave as text. They
left-align. 2 is greater than 100. They sort wrong. The criteria works
wrong. Numeric operations (such as summing) fail.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Ben W" <BenW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C141E82-B89D-4804-8797-EBDDEFF0A3D7@xxxxxxxxxxxxxxxx
Hi,
Thanks for the quick response!! I'm not trying to assign the string as
part
of the SQL, I'm building this part of the string seperately, and then
adding
it into the SQL which is built further down the script. Anyway....this
works
great and does exactly what I want....well nearly, it's actually in £
instead
of Euro - Looking at my original post it replaced the Euro symbol with a
"?".
Bizarre!?!?
So, this piece of code below works great for sterling. I also need it
replicated for Euro and US Dollar. Would you be kind enough to show me
what
the command for this is. Here's the working code for sterling:
rev_calc = "CCur(Nz(Sum([tbl_Union_Sales].[Final_Revenue]),0)) AS [Revenue
£],"
Thanks very much!!
.
- References:
- Re: How to convert text to number in a query?
- From: Allen Browne
- Re: How to convert text to number in a query?
- Prev by Date: Re: Parameter Queries
- Next by Date: Re: Data type mismatch in criteria expression
- Previous by thread: Re: How to convert text to number in a query?
- Next by thread: Re: How to convert text to number in a query?
- Index(es):
Relevant Pages
|