Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ceiling function - URGENT

Status
Not open for further replies.

Dboz0000

Instructor
Sep 23, 2004
4
NZ
Hi
Hope you all good.

Trying to get a ceiling function to working in Crystal 9 - have to create it coz Crystal doesn't seem to have it.
It works fine in My Access VBA Module
Here is the VBA code that works fine (found it on the net):

Public Function Ceiling(ByVal X As Double, Optional ByVal Factor As Double =
1) As Double
' X is the value you want to round
' is the multiple to which you want to round
Ceiling = (Int(X / Factor) - (X / Factor - Int(X / Factor) > 0)) *
Factor
End Function

How do I write that as a working function in Crystal that I can call in
another function later?
(May seem dumb - but also been beating my head again a brick wall with
regards to another "problem" I'm having with regards to an DAO Error
Code:0xc0d error - see next post on that one.)

Any help will be GREAT.

D
 
In 8.0 there is a ceiling function available in the SQL Expression editor. You might see if this meets your needs.

-LB
 
Thanx for that LB,
But (there's always a but - ain't there?):
Can't seem to find it in 9.0
Created a new SQL Expression - looked in the Functions tree (and Operators tree for good measure) can't seem to find ceiling.
Am I looking in the right place?
 
By Ceiling function, do you mean a function that rounds up to an increment?

If so, this should do the trick. Where the .5s are the increment you want to round.

-int(-({number}/.5))*.5

Mike
 
In 8.0, using the Extreme Database, ODBC connection, I see it under functions->numeric->ceiling, but I think the functions available might vary based on the datasource or connectivity.

-LB
 
Thank you all so much.
You've been a great help.
Went with the int - seems to be working fine so far.
Brilliant!
Again, thanx heaps people.
This is a most useful resource this website and it's members are.
Good on ya'all.

D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top