UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Converting data format using SQL statement    
 
   
M3Drivers
post May 24 2005, 08:09 AM
Post #1

New Member
Posts: 10



Hello all,
I'm trying to format data returned by a SQL select query in MS Access. For ex, I have data dispaying as "6500000" when I desire commas to denote thousands and perhaps to take it out 2 or more decimals (i.e. "6,500,000.00").

Any way to enforce this formatting with a Select statement? I've seen "Cast" and "Convert" but I don't think these play in the Access SQL world, at least if they do I can't figure the syntax out.

Any ideas out there? Thanks in advance for any assistance.
Go to the top of the page
 
+
 
Start new topic
Replies (1 - 6)
truittb
post May 24 2005, 08:12 AM
Post #2

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



Format the control on the form or report where the data is being displayed. It doesn't need to be formatted at the query level, users shouldn't have access to the tables or queries.
Go to the top of the page
 
+
tszeis
post May 24 2005, 08:21 AM
Post #3

UtterAccess Veteran
Posts: 482
From: Missouri



I agree with Fiat. You also have the option to apply formats in your tables. Type in "Format Property" in Access help. You should find what you are looking for.
Go to the top of the page
 
+
M3Drivers
post May 24 2005, 08:46 AM
Post #4

New Member
Posts: 10



Thank you both for your replies, and you are certainly right about using reports/forms to control the data.

We have a tendency to need answers on the fly, so this is not really an end user consumption database application, but rather a working research database so to speak. The constantly changing data needs rules out reports as they are inflexible and laborious to modify, however it is still nice for clarity to get the formatting right on the screen even if it never goes to print.

I believe there is a date format handling function like: select format(date,dddd). Surely there is an equivalent SQL funciton for number formats also. If not, I guess I'll have to go the report route.

Thanks again guys. Really appreciate the input
Go to the top of the page
 
+
truittb
post May 24 2005, 09:26 AM
Post #5

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



Format(FieldName,"#,##0.00")
Go to the top of the page
 
+
M3Drivers
post May 24 2005, 09:44 AM
Post #6

New Member
Posts: 10



That syntax does it - thanks so much!!! Really appreciate the time and expertise.
Go to the top of the page
 
+
truittb
post May 24 2005, 09:46 AM
Post #7

Retired Moderator
Posts: 13,544
From: Texas (Is there anywhere else?)



You are welcome.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 04:40 PM