Formatting a query field

T

TJ Durrant

I've got a field that returns a percent:

Format([Sample_Grids]/30,"Percent")

But when I send it to Excel it's recognized as a text field instead of
a number field. So far I've tried:

Format([Sample_Grids]/30, "#0.00") & "%" and
CDbl(Format([Sample_Grids]/30, "#0.00") & "%"))

I'm self taught so there might be an easy solution I'm unaware of. I
just need it to do the calculation and be recognized as a number field
when sent to Excel. The Sample_Grids table column is formatted as a
number. Thanks for the help.
 
J

John W. Vinson

I've got a field that returns a percent:

Format([Sample_Grids]/30,"Percent")

But when I send it to Excel it's recognized as a text field instead of
a number field. So far I've tried:

Format([Sample_Grids]/30, "#0.00") & "%" and
CDbl(Format([Sample_Grids]/30, "#0.00") & "%"))

I'm self taught so there might be an easy solution I'm unaware of. I
just need it to do the calculation and be recognized as a number field
when sent to Excel. The Sample_Grids table column is formatted as a
number. Thanks for the help.

The Format() function always returns a String value; concatenating a string to
a number does the same.

Just set the calculated field to

[Sample_Grids] / 30

and set the Format property of the query field, or (better) the Form or Report
textbox in which it is displayed, to Percent. You'll also want to set the
format of the Excel sheet cell to the same.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

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