troubleshooting Question

VBA: Find the number of days that occured between dates in records. Example Attached

Avatar of Ryan Simmons
Ryan Simmons asked on
8 Comments4 Solutions110 ViewsLast Modified:
In the attached worksheet I have two tabs. The first tab is example data I am working with. The second tab is the result I am looking for. The data lives in a MS Access 2016 database.

I worked with a expert on this forum seeking a query solution. However he recommended VBA as a solution.

What I need to do is to loop the sorted table in VBA and then, record by record, find the count of days between each originatordn and the previous record.
Then append the record to a new table.

The goal is to calculate the days since last call for every originatordn.

Example Result:
originatordn      Date      Month      Year      DaysSinceLastCall
2053843380      01-Jan-17      1      2017      0
2053843380      03-Jan-17      1      2017      2
2053843380      05-Jan-17      1      2017      2
2053843380      08-Jan-17      1      2017      3
2053843380      18-Jan-17      1      2017      10
2053843380      28-Jan-17      1      2017      10
Reporting Automation Expert

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros