473,377 Members | 1,119 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,377 software developers and data experts.

count year to year between two dates

i'm creating assets tracking data base, i have to set asset depreciation every year of asset life, i am using datediff() but it count total duration of asset, i want that starting date and ending date and computer count integer number until the ending date for example purchased asset date 12-Aug-2010 useful life of Asset is 12-Aug-2014, between both dates computer account automatically number that has been passed ..
Aug 19 '14 #1
1 1094
twinnyfo
3,653 Expert Mod 2GB
irfanEmmaneul,


Try a public function similar to this:

Expand|Select|Wrap|Line Numbers
  1. Public Function WhatIsAge(AssetDate As Date) As String
  2.     Dim intYears As Integer
  3.     Dim intMonths As Integer
  4.     Dim intDays As Integer
  5.     intYears = Format(Date - AssetDate, "yy")
  6.     intMonths = Month(Date - AssetDate) - 1
  7.     intDays = Day(Date - AssetDate)
  8.     WhatIsAge = "Asset is " & _
  9.         intYears & " years, " & _
  10.         intMonths & " months, " & _
  11.         intDays & " days old."
  12. End Function
It may be a good place to start. Hope this hepps!
Sep 8 '14 #2

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

Similar topics

9
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed...
3
by: Matt | last post by:
Hello, I have a query that I would like to schedule in DTS. The criteria of this query checks for records in the table that are within the current quarter. Here is what I have. WHERE...
4
by: Alicia | last post by:
I am having a problem grouping by week. I am looking for the simpliest way of doing it in Microsoft Access. I have tried to use a pre-loaded calender, access did not like it at all. If there is...
1
by: Alicia | last post by:
I basically wanted something that would do a count of the dates, then group them by their week name.. BEFORE: Resource Date Total number of times that date Appeared (Count) 4/3/03 ...
5
by: moddster | last post by:
Hi Guys. I am a newbie to perl and need some help with a problem. PROBLEM: I have to parse an HTML file and get rid of all the HTML tags and count the number of sumbissions a person has through...
9
by: sha2484 | last post by:
I need help to count days between 2 dates,where i want to count the days between current date and registeration date.Here is the code that i have write but it only compare the days , it do not...
1
by: kummu4help | last post by:
hi, i am using mysql. i have 3 tables with following structures. these are not actual tables i am working on. table A id varchar(16),name varchar(255),InDate datetime table B id...
11
wordbrew
by: wordbrew | last post by:
Hello all, I’m beginning to get a pretty good foundation in VBA, but I can’t wrap my head around this problem, even after trolling around the net searching through other posts that seemed remotely...
2
zaffer
by: zaffer | last post by:
SELECT trunc(sysdate) dt, count(*) as count FROM ATM_MONITOR.ATM_PROBLEM WHERE trunc(sysdate) = trunc(create_time) union SELECT trunc(sysdate)-1 dt, count(*) as count FROM...
7
by: time2hike | last post by:
Hi, I am struggling with pulling data for multiple projects and then standardizing the data so it can be used in modeling and comparisons. Overview: We are building a modeling system that allows...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.