CALCULATE PERCENT FOR A VALUE ENTERED IN A FORM OF A STRING

N

nn

I have created a field chemistry with type as text. the data entered for 150
marks which i want to convert to percentage. Help me in converting the same.
The formayt i tired was =val(che)*150/100 which gives a wrong conversion in
few places
 
J

John Spencer

Wrong conversion? Can you give a specific example of what you are converting
(the value in CHE), what you get, and what you want to get?

I might guess that Val is returning zero when you expect it to return something.

Val("o1") (that is letter o followed by number 1 returns zero. So if you are
getting zero as result, check what is actually in the field Che.

Val("123o45") will return 123. IF you want to check all the records at once,
you can use a query like the following to find those values that may not be
properly converted.

SELECT CHE
FROM SomeTable
WHERE IsNumber(Che) = False

In the query grid
Field: CheckChe: IsNumber([Che])
Criteria: False



John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Top