Question

I'm working with MS Access to do some math. I'm taking a Cost and Dividing it by a decimal value to get a Price. I'm using a link table and a access sql query.

SQL Ex

Select (cost/markup) As Price From T_Cost;

Calulcation Ex. 1234 / .55 = 2243.6363 1000 / .50 = 2000

I'm trying to figure out a way to remove the decimal places that will work when there are decimals and when there are not.

I was thinking of doing something like this in my Access SQL:

Mid("2243,6363", 0, Instr("2243,6363","."))

But this won't work if there is not a decimal place.

Was it helpful?

Solution

Use Round. That's what it's designed for. However I'm curious. Why wouldn't you want the cents?

OTHER TIPS

To remove the numbers after the decimal point:

Int(number)

or in your case

Int(cost/markup)

New SQL is:

Select Int(cost/markup) As Price From T_Cost;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top