Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Writing Invoice Age
James Hopkins 
     
3 years ago
Hey Guys, I am trying to figure out the right way to writing the Invoice Age by "Months and Years".

Here's what I got:
InvoiceAgeDays: DateDiff("d",[InvoiceDate],Date())
InvoiceAgeMonths: DateDiff("m",[InvoiceDate],Date())
InvoiceAgeYears: DateDiff("yyyy",[InvoiceDate],Date())

InvoiceAge: [InvoiceAgeMonths] & " mo " & IIf([InvoiceAgeDays]=30,"","d") & ", " & [InvoiceAgeYears] & " yrs." & IIf([InvoiceAgeMonths]=12,"","mo.")
Adam Schwanz  @Reply  
           
3 years ago
InvoiceAge: InvoiceAgeYear & " Years and " & InvoiceAgeMonths & " Months and " & InvoiceAgeDays & " Days"

Would say something like
"5 Years and 2 Months and 14 Days"
Adam Schwanz  @Reply  
           
3 years ago
I don't really know what you're trying to accomplish with the IIF statements
Kevin Robertson  @Reply  
          
3 years ago
You don't want 1 day, 1 month and 1 year to show as 1 days, 1 months and 1 years so I would write it like this:

InvoiceAge: InvoiceAgeYear & IIF(InvoiceAgeYear=1," year"," years") & ", " & InvoiceAgeMonths & IIF(InvoiceAgeMonths=1," month"," months") & " and " & InvoiceAgeDays & IIF(InvoiceAgeDays=1," day"," days")

This will give the singular if the value is 1 or the plural if any other value.
Richard Rost  @Reply  
           
3 years ago
Check out HowLong
James Hopkins OP  @Reply  
     
3 years ago
Thanks Guys for your Time and Help....

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/9/2026 5:04:20 PM. PLT: 0s