Results 1 to 2 of 2

Thread: Ms Access - Get data from previous entry

  1. #1
    Join Date
    May 2012

    Ms Access - Get data from previous entry

    So far, when I scan a product, it records the current time with a Now function. What I need is to know how much time elapsed since my last scan by doing a Datediff function with the previous time recorded. My problem is that I can't manage to get the previous scan time.

    I thought of two ways to do this.

    1. Previous_scan = DMax("[Hours]", "Data", "Hours < Now()")
    This does not work. If I change the criteria to "Hours <= Now()", it gives me the current time as if my function could not find other times recorded than the current time.

    2. My second idea was to use a Dlookup and use my autonumber to look for "the current autonumber - 1" in order to get the previous time recorded. But I can't manage to create the variable in order to do this.

    Anyone has any idea to solve this ? I've been working on this for 2 days already and it's getting on my nerves.

    Thank you so much !

  2. #2
    Join Date
    May 2012
    Here is a part of my actual code.

    "Product" is the product number when an item is scanned.
    "Hours" is the current time when an item is scanned.
    I want "Hours_finish" to be the time of the previous scan.

    If Product <> 0 Then
    Hours = Now()
    End If

    If Product <> 0 Then
    Previous_scan = DMax("[Hours]", "Data", "Hours < Now()")
    End If

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles