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 
DateDiff on a form
Kim Boren 
      
3 years ago
I would like to have a text box on a form that will tell me how many days in the future from today.
Kevin Robertson  @Reply  
          
3 years ago
Is this what you mean (screenshot below)?
Kevin Robertson  @Reply  
          
3 years ago

Kim Boren OP  @Reply  
      
3 years ago
Kevin, thank you for your post. I was thinking to use the same future date of 9/1/2025 and the difference change without a button by using Date().
Kevin Robertson  @Reply  
          
3 years ago
Kim Boren OP  @Reply  
      
3 years ago
Kevin, I am sorry I am not sure I understand. When I enter a form I would like to see the number of days displayed from today to 9/1/2025.
Kevin Robertson  @Reply  
          
3 years ago
There are three events that will run when the form opens.

OnOpen
OnLoad
On Current Event (Also runs when you move between records)

For a static date just add it to the function:
NumDays = DateDiff("d", Date, #9/1/2025#)

Since the future date doesn't change I'd use either the OnLoad Event or the OnOpenEvent.

As a side note what happens after 9/1/2025? It will no longer be a future date. If this date does need to change in the future consider using a field in a settings table so the date can be easily changed rather than hard coding the date in your VBA.
Kim Boren OP  @Reply  
      
3 years ago
Kevin,
I must be misunderstanding something.
I entered the code in each of the events for this form and nothing shows in the text box.
This display will be in a main form that opens when access is opened.
Sorry, I thought I would understand what you have been trying to tell me.
Kevin Robertson  @Reply  
          
3 years ago
Please post some images of what you have.

Also, watch these videos if you haven't already.
Intro to VBA
DateDiff

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/6/2026 10:21:06 PM. PLT: 3s