Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2007

Tip: Looking for answers? Try searching our database.

Truncating whole numbers to be 4 digits

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mpfohl@hotmail.com - 06 May 2007 15:48 GMT
I have a key that the user enters and then I want to manipulate. The
user enters a 4 digit number (X), and I run my equation on it (let's
say, X*2) and return back a 4 digit number.  What the number is
doesn't really matter, as long as it is consistant each time the user
enters the same number, and as long as it is exactly 4 digits long.

So basically, I need a way to truncate integers.  how do i say take 4
digits from (X*2) ?

Thanks
Arvin Meyer [MVP] - 06 May 2007 16:02 GMT
It would depend upon which 4 digits you wanted. You can get the left 4:

Left(x*2,4)

or the right 4:

Right(x*2,4)

If you need them to be a number instead of a string, just convert it back:

CInt(Right(x*2,4))
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

>I have a key that the user enters and then I want to manipulate. The
> user enters a 4 digit number (X), and I run my equation on it (let's
[quoted text clipped - 6 lines]
>
> Thanks
mpfohl@hotmail.com - 06 May 2007 21:36 GMT
Perfect, thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.