473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Trunc function in Access

38
I feel stupid for acking but is there an equavelent function to Trunc in Access? Int and Fix funtions all do rounding to neareast integer, I need a way to extract only the integer portion of a decimal number.
Thanks for the help
Feeling Stupid...
Feb 20 '08 #1
4 21459
Scott Price
1,384 Expert 1GB
In my testing, the Int() function does just what you are wanting. It doesn't round to the nearest value.

Regards,
Scott
Feb 20 '08 #2
Scott Price
1,384 Expert 1GB
If you feel like testing my claim :-) Go into the Immediate window of your VBA code editor. (Press Alt+F11 from inside Access to open the editor window) and type ?Int(2.99999999) then press enter. The result is 2.

Regards,
Scott
Feb 20 '08 #3
salzan
38
Thank you all, greatly appreciate it.
Salzan
Feb 20 '08 #4
ADezii
8,834 Expert 8TB
I feel stupid for acking but is there an equavelent function to Trunc in Access? Int and Fix funtions all do rounding to neareast integer, I need a way to extract only the integer portion of a decimal number.
Thanks for the help
Feeling Stupid...
FYI, both Fix() and Int() will work for Positive Numbers. They both will remove the fractional part of number and return the resulting integer value.

The only difference between Int and Fix is that if a number is negative, Int returns the first negative integer less than or equal to the number, whereas Fix returns the first negative integer greater than or equal to the number.

For example:
Expand|Select|Wrap|Line Numbers
  1. Int(-8.4) ==> returns -9
  2. Fix(-8.4) ==> returns -8
Feb 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Martin Vorbrodt | last post by:
Example code in one of my books intrigues me: class B { public: B* Clone() const { B* p = DoClone(); assert(typeid(*p) == typeid(*this)); return p; }
7
by: Alex | last post by:
Hi all, I've found a module that I think will help me combine fields properly, but I'm unsure how to add or use it with Access 2000. Below is the module I'd like to add: ...
7
by: Giulio | last post by:
I can't understand where is the problem: this is the file I would like to compile ------------------------ #include <math.h> #include <stdlib.h> int main (){ int c = trunc(17.5); return c; }
6
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the...
11
by: Yelena Varshal via AccessMonster.com | last post by:
Hello, I have a problem with one of msaccess.exe API calls that work on my desctop but does not work on the laptop from within MS ACCESS. There is a lot of differences between 2 computers...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
4
by: aryan | last post by:
Hi, I would like to know which of the following would be faster unlink(filename); fileName.open( filename,ios::out); or fileName.open( filename,ios::trunc | ios::out);
1
by: seanmatthewwalsh | last post by:
Hi I have a website that uses an Access 2003 database. I have controls on my pages that are bound to SqlDataSources that pull data from this database. In a couple of them, I need to use the...
2
by: Immortal Nephi | last post by:
I design a class for general purpose. I do not allow a client to read or modify interface and implemention. I allow them to write a new non- member function outside of class' interface and...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.