Formatting a query field

  • Thread starter Thread starter TJ Durrant
  • Start date Start date
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.
 
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
 
Back
Top