Specifying Exact Size of Number Field for Output Feed

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hi everyone,

I am working on an Access 97/Access XP application that requires that
numbers extracted from the database be a certain total size, with there
being an exact number of decimal places.

For example, let's say that the extracted field is called "Units." The
specification for "Units" requires that the whole field must occupy 10
positions, and that there be 4 decimal places.

Is there a way to set this up in Access as part of the table Fieldsize
properties?

Or is there a better way to accomplish my goal?

Thanks for your help and suggestions.

Alan
 
Normally, when you export Field Values from a Table, Access will only export
the values and ignore the Format Property of the Field.

However, you can use the Format() function on the Field to create a
*Calculated* Field in a Query to format the Field values to what you want
and then you can export the Query rather than the Table and the "Units" will
be exported in the required format.

For example, you can create a Calculated Field:

Units10C4DP: Format([Units], "00000.0000")

You can even pad with spaces if you want. Please note that you must make
sure that the format can accommodate ALL the numerical values. Otherwise,
Access will increase the digits left of the decimal point to accommodate the
value if required. For the formatting String above, the non-negative value
must be less than 99999.99995.
 
Thank you, Van. That what was I was looking for.

Alan

Van T. Dinh said:
Normally, when you export Field Values from a Table, Access will only export
the values and ignore the Format Property of the Field.

However, you can use the Format() function on the Field to create a
*Calculated* Field in a Query to format the Field values to what you want
and then you can export the Query rather than the Table and the "Units" will
be exported in the required format.

For example, you can create a Calculated Field:

Units10C4DP: Format([Units], "00000.0000")

You can even pad with spaces if you want. Please note that you must make
sure that the format can accommodate ALL the numerical values. Otherwise,
Access will increase the digits left of the decimal point to accommodate the
value if required. For the formatting String above, the non-negative value
must be less than 99999.99995.

--
HTH
Van T. Dinh
MVP (Access)




Alan said:
Hi everyone,

I am working on an Access 97/Access XP application that requires that
numbers extracted from the database be a certain total size, with there
being an exact number of decimal places.

For example, let's say that the extracted field is called "Units." The
specification for "Units" requires that the whole field must occupy 10
positions, and that there be 4 decimal places.

Is there a way to set this up in Access as part of the table Fieldsize
properties?

Or is there a better way to accomplish my goal?

Thanks for your help and suggestions.

Alan
 
Back
Top