Undefined Funcion error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all!

I'm using Access 97.

I'm trying to do a Query, to convert a decimal number to a integer one.
If the Decimal part of the number is less than 50 ( 2 decimal places ), then
the result would be the integer part of it.
If the Decimal part of the number is more than 50 ( 2 decimal places ), then
the result would be the integer part of it, plus 1.

I've tryed with FLOOR function, but it gives me an error: "Undefined
function Floor in expression".

I've also tried this:
select Floor ( 100.98 ) from ........
and it gives me the same error.

Can't I use Floor function inside a SQL query?
Or, can I do it a better - and simpler - way?


Thanks a lot in advance.

Best regards,
Joaquim.
 
ACCESS does not contain a FLOOR function. However, the Round function may
work for your purposes. Round is a built-in VBA function. You can call it
from a query:

Round([MyFieldName], 0)

The above expression will round to the nearest whole number.
 
Ken,


Thanks for your reply.

I've tryed the following ( simple ) query:
select round ( 100.98, 0 ) from MyTable
and the error is the same.

Access tells me: "undefined function 'round' in expression".


Any more ideas?


Best regards,
Joaquim.





Ken Snell said:
ACCESS does not contain a FLOOR function. However, the Round function may
work for your purposes. Round is a built-in VBA function. You can call it
from a query:

Round([MyFieldName], 0)

The above expression will round to the nearest whole number.

--

Ken Snell
<MS ACCESS MVP>

Joaquim Macedo said:
Hi all!

I'm using Access 97.

I'm trying to do a Query, to convert a decimal number to a integer one.
If the Decimal part of the number is less than 50 ( 2 decimal places ),
then
the result would be the integer part of it.
If the Decimal part of the number is more than 50 ( 2 decimal places ),
then
the result would be the integer part of it, plus 1.

I've tryed with FLOOR function, but it gives me an error: "Undefined
function Floor in expression".

I've also tried this:
select Floor ( 100.98 ) from ........
and it gives me the same error.

Can't I use Floor function inside a SQL query?
Or, can I do it a better - and simpler - way?


Thanks a lot in advance.

Best regards,
Joaquim.
 
Joaquim said:
Ken,


Thanks for your reply.

I've tryed the following ( simple ) query:
select round ( 100.98, 0 ) from MyTable
and the error is the same.

Access tells me: "undefined function 'round' in expression".

I don't believe the round function existed until after Access 97. You'll need
to write your own custom function.
 
Round was new in VBA 6, and the first version of Access to incorporate VBA 6
was Access 2000. For Access 97, use the function at the following URL. Just
copy and paste the code into a standard module (not a form or class module)
and you can use it in your query as though it were a built-in function.

http://www.mvps.org/access/modules/mdl0054.htm

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Joaquim Macedo said:
Ken,


Thanks for your reply.

I've tryed the following ( simple ) query:
select round ( 100.98, 0 ) from MyTable
and the error is the same.

Access tells me: "undefined function 'round' in expression".


Any more ideas?


Best regards,
Joaquim.





Ken Snell said:
ACCESS does not contain a FLOOR function. However, the Round function may
work for your purposes. Round is a built-in VBA function. You can call it
from a query:

Round([MyFieldName], 0)

The above expression will round to the nearest whole number.

--

Ken Snell
<MS ACCESS MVP>

message
Hi all!

I'm using Access 97.

I'm trying to do a Query, to convert a decimal number to a integer one.
If the Decimal part of the number is less than 50 ( 2 decimal places ),
then
the result would be the integer part of it.
If the Decimal part of the number is more than 50 ( 2 decimal places ),
then
the result would be the integer part of it, plus 1.

I've tryed with FLOOR function, but it gives me an error: "Undefined
function Floor in expression".

I've also tried this:
select Floor ( 100.98 ) from ........
and it gives me the same error.

Can't I use Floor function inside a SQL query?
Or, can I do it a better - and simpler - way?


Thanks a lot in advance.

Best regards,
Joaquim.
 
Thank you, to all who have helped solved this question.


Best regards,
Joaquim.



Brendan Reynolds said:
Round was new in VBA 6, and the first version of Access to incorporate VBA 6
was Access 2000. For Access 97, use the function at the following URL. Just
copy and paste the code into a standard module (not a form or class module)
and you can use it in your query as though it were a built-in function.

http://www.mvps.org/access/modules/mdl0054.htm

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Joaquim Macedo said:
Ken,


Thanks for your reply.

I've tryed the following ( simple ) query:
select round ( 100.98, 0 ) from MyTable
and the error is the same.

Access tells me: "undefined function 'round' in expression".


Any more ideas?


Best regards,
Joaquim.





Ken Snell said:
ACCESS does not contain a FLOOR function. However, the Round function may
work for your purposes. Round is a built-in VBA function. You can call it
from a query:

Round([MyFieldName], 0)

The above expression will round to the nearest whole number.

--

Ken Snell
<MS ACCESS MVP>

message
Hi all!

I'm using Access 97.

I'm trying to do a Query, to convert a decimal number to a integer one.
If the Decimal part of the number is less than 50 ( 2 decimal places ),
then
the result would be the integer part of it.
If the Decimal part of the number is more than 50 ( 2 decimal places ),
then
the result would be the integer part of it, plus 1.

I've tryed with FLOOR function, but it gives me an error: "Undefined
function Floor in expression".

I've also tried this:
select Floor ( 100.98 ) from ........
and it gives me the same error.

Can't I use Floor function inside a SQL query?
Or, can I do it a better - and simpler - way?


Thanks a lot in advance.

Best regards,
Joaquim.
 
Back
Top