• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

How to find out the date difference from an access database table?

Hi Experts,
I have a table that collects date shortdate (every day when users login).
For example:
3/17/2006
3/18/2006
3/19/2006
3/20/2006
3/21/2006

I need a VB function to find out the date difference between the last record which is 21 ,20 and .... 17. for 15 days of the month.
0
bryanche
Asked:
bryanche
  • 3
  • 3
1 Solution
 
suprapto45Commented:
Hi,

Can't you use DateDiff function available in VB?

http://www.vb-helper.com/howto_ellapsed_time.html

David
0
 
bryancheAuthor Commented:
Thanks! That's a good example. But I'd like to have the difference between range of dates from 1 to 15 records.
0
 
bryancheAuthor Commented:
Experts!
I think I found it out myself. Here's what I have.

Dim DateDiff As Integer
Dim iRow As Integer

Dim intRecCount As Integer
Dim datStartDate As Date
Dim datFinishDate As Date

With Rs
    .MoveLast
    datFinishDate = !LOGOUT_DATE
    .MoveFirst
    datStartDate = !LOGOUT_DATE
    intRecCount = .RecordCount
    For iRow = 1 To intRecCount
        DateDiff = datFinishDate - datStartDate
    Next iRow
End With

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
bryancheAuthor Commented:
Dear Moderators,
Thanks for suprapto45. But I found my answer myself. So please close my question and refund my points if possible.
0
 
suprapto45Commented:
Hi,

I am okay with it...refund. Please post your request to refund your question in Community Support TA.

David
0
 
suprapto45Commented:
Please let me know if you do not know how to do it. I will request it for you

David
0
 
DarthModCommented:
PAQed with points refunded (125)

DarthMod
Community Support Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now