Re: Someone write a BankersRound UDF...

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ian Boyd (ian.msnews010_at_avatopia.com)
Date: 08/13/04


Date: Fri, 13 Aug 2004 10:19:42 -0400


> See if this works for you:
>
> case when d = floor(d) then d else
> case sign(ceiling(d) - 2*d + floor(d))
> when 1 then floor(d)
> when -1 then ceiling(d)
> else 2*round(d/2,0) end
> end
>
> If you put the expression (this one or one that works) inline instead of
> as a user-defined function, it will likely be faster. There is some
> chance of overflow here, but not until you deal with very large amounts
> of money.

Thanks Steve. It seems to work :)

i definetly would rather have it as a function. The last buggy routine was
easy to fix, since it was a UDF that i only had to change in the one spot.



Relevant Pages

  • Re: Combining child records
    ... The article uses a user-defined function (UDF) call. ... run 10 times slower than they used to when called in a query. ... > 322813 to combine child records in my database. ...
    (microsoft.public.access.queries)
  • Re: Access 2007 errror
    ... I managed to fix this strange problem. ... make the database the Design Master. ... user-defined function, or. ... There may have been an error evaluation the function, event, or macro. ...
    (microsoft.public.access.formscoding)
  • Problem with UDF
    ... If I have a user-defined function that I use to, say, calculate a ... If the answer to the first question is no, I will have to pass the cell ... address explicitly as a parameter of the UDF. ... Liosan ...
    (microsoft.public.excel.programming)
  • Re: Stored Procedure/UDF help
    ... > You can't use column values as parameters for a user-defined function. ... *table-valued* UDF. ... David Portas ... SQL Server MVP ...
    (microsoft.public.sqlserver)
  • Re: Calling a UDF from a VB SQL statement
    ... Access can recognize UDF in queries only if you run it using Access, ... so if you need to run action query - you can use docmd.runsql, and if you need to open recordset - remove UDF from select and run it in VBA ... need it to go something like this, assuming my user-defined function is ... "Undefined Function" if I leave it in the double quotes. ...
    (microsoft.public.access.modulesdaovba)