Use ½ as 0.5

Somebody

Registered User.
Local time
Today, 18:19
Joined
Apr 30, 2008
Messages
16
hi

i have a table where a field is a diameter of a pipe. This diameter is entered by a form as an integer or as a fraction of type : ¼ ½ ¾

i need to calculate the average of these diameters, but it wil take the fractions as text and not use them

is there a function or setting i can use to make access use these fractions?

Thank you for your help
 
If you only have to work with the 3 fractions then nest an iif in an iif when you run the query or on the form to convert ¼ ½ ¾ into .25 .5 .75
iif([PipeDiameter]="¼", .025, (iif([PipeDiameter]="½", .05, .75)))

Easier would be to add a field to the table for the decimal equivalent of the text, then you can cover the fractions that do not have a text equivalent.
 
Last edited:
Simple Software Solutions

I thought we had gone decimal when buying pipe diameters nowadays? Why not give the user the option to enter either imperial or metric and do a conversion on the after update of the field and store a more manageable value in the field.

CodeMaster::cool:
 
WOW

pretty clever, thanks fifty2one

as for putting both imperial and metric, it would be the best but a big headache to figure all those details. The best would be for everyone just to convert to the same system...

thanks and keep up the good work guys
 
I would be storing the diameter as a decimal number in a single measuring system, but that doesn't stop you capturing it as text, imperial or metric, and holding what was entered for display purposes. So you can enter 1/2" and store it, but a second field shows 0.5. Using text fields to store numeric values is asking for trouble, sooner or later.
 

Users who are viewing this thread

Back
Top Bottom