Format a calculated field in a query

D

Dave

Access 2003
Calculated field in a query
EX: Monthly: [Salary]]/12

Answer 24808.333333333333

I know I can format the calculated field in a report run off this query (Or
just do the calculated field on the report)
BUT
Can I format this in the query??
To look like any/all of these
24808.33
24,808.33
$24,808.33
$24,808


Thanks

dave
 
D

Dale Fye

Format([salary]/12, "currency")
Format(salary/12, "##,###.##")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
D

Dave

Thanks - they both gave me
24808.33 - which is better then what I had )

neither gave me a $ or a ,

dasve

Dale Fye said:
Format([salary]/12, "currency")
Format(salary/12, "##,###.##")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Dave said:
Access 2003
Calculated field in a query
EX: Monthly: [Salary]]/12

Answer 24808.333333333333

I know I can format the calculated field in a report run off this query
(Or
just do the calculated field on the report)
BUT
Can I format this in the query??
To look like any/all of these
24808.33
24,808.33
$24,808.33
$24,808


Thanks

dave
 
M

Marshall Barton

Dave said:
Access 2003
Calculated field in a query
EX: Monthly: [Salary]]/12

Answer 24808.333333333333

I know I can format the calculated field in a report run off this query (Or
just do the calculated field on the report)
BUT
Can I format this in the query??
To look like any/all of these
24808.33
24,808.33
$24,808.33
$24,808

You can, but the formatted value will be Text instead of a
number. If that's what you really want (not a good idea,
IMO), the use the Format function.

OTOH, maybe the Round function is what you are looking for??
 
D

Dale Fye

Marsh,

If all he wants to do is display a monthly salary figure, why is using
format function "not a good idea"?

Dave,

I'm not sure what your regional settings are, but since you used the $ sign,
I'll assume you are US, in which case:

Format(297700/12, "Currency") should display $24,808.33
and
Format(297700/12, "#,#.##") should display 24,808.33

Dale

Marshall Barton said:
Dave said:
Access 2003
Calculated field in a query
EX: Monthly: [Salary]]/12

Answer 24808.333333333333

I know I can format the calculated field in a report run off this query
(Or
just do the calculated field on the report)
BUT
Can I format this in the query??
To look like any/all of these
24808.33
24,808.33
$24,808.33
$24,808

You can, but the formatted value will be Text instead of a
number. If that's what you really want (not a good idea,
IMO), the use the Format function.

OTOH, maybe the Round function is what you are looking for??
 
M

Marshall Barton

Dale said:
If all he wants to do is display a monthly salary figure, why is using
format function "not a good idea"?


IMO, formatting in a query obscures the real data. I
believe that formatting is properly done as late as
possible, i.e. when the data is presented to users in a form
or report text box.
 
D

Dale Fye

I could get on board with that.

So, if I understand you correctly, instead of using the format function in
the query, you would use the format property of the textbox on the form or
control.

--
Dale

email address is invalid
Please reply to newsgroup only.



Dave said:
Thanks - they both gave me
24808.33 - which is better then what I had )

neither gave me a $ or a ,

dasve

Dale Fye said:
Format([salary]/12, "currency")
Format(salary/12, "##,###.##")

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Dave said:
Access 2003
Calculated field in a query
EX: Monthly: [Salary]]/12

Answer 24808.333333333333

I know I can format the calculated field in a report run off this query
(Or
just do the calculated field on the report)
BUT
Can I format this in the query??
To look like any/all of these
24808.33
24,808.33
$24,808.33
$24,808


Thanks

dave
 
D

Dave

Arguments of "when" aside I was an idiot not to know you could just right
click on the query field and format. :( :(

This was for a demonstration (On quires) - so I needed it here
but I would have to agree with Marshall it would be better to do it later
(in the report)

Thanks for all the replies

dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top