Forcing data to be stored in special format

D

DianePDavies

Can I make field definitions that force my data to be formatted in a special
way?

I have a table with different fields - some should be formatted with 3
decimals, some with 2 and some with none etc.

I would like data to be saved in this format, so that when I extract it as
"text" it shows up right.

I extraxt it as text because I want to "transpose" my records from long rows
of data to tall columns (for better comparison of records). To transpose I
have had to write a routine that fills data from my original data record in
to a display table where I list the field name and the values in the rows of
this display table.

When showing the values they have all kinds of decimals - and I just want
them to reflect the format I have set in the original data table.

I hope this makes sense....
 
D

David Cox

It is best to leave formatting untill you output the records. The Format
function is very powerful, and you should be able to display your data
exactly as you want it.

It is good policy to leave data at its maximum precision in the database,
especially if it is ever going to be involved in calculations.
 
D

DianePDavies

As a general statement you are right.

In this case I need to know how each field is formatted when I "transpose"
my values. Here it would be nice just to be able to take the format from the
original table.
 
J

John Vinson

In this case I need to know how each field is formatted when I "transpose"
my values. Here it would be nice just to be able to take the format from the
original table.

Then you're stuck storing it in Text fields, I'd guess. As a Number,
3.200 and 3.2 are exactly the same number stored in exactly the same
bits and bytes. Especially if the format changes from record to
record, I don't see any way to both store the value as a number and
store its format.

John W. Vinson[MVP]
 

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