473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

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 !
May 29 '12 #1
2 1631
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
May 29 '12 #2
Rabbit
12,516 Expert Mod 8TB
Use the first method. But you need to limit on some sort of product id. What you have there returns the max of all the products. I assume you only want the max of the product you're scanning.
May 29 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jerry Hull | last post by:
I have a user who can not change data in a field to different data that starts with the same letter. If the user types in "lag" as the entry, and then tries to change it to "lg", the data changes...
16
by: jhwagner | last post by:
I need to use double data entry with an MS Access database. I have read many arguments and reasons against this on this group but I have to do this. I have seen various tips on how this can be...
1
by: sympatico | last post by:
Hi, We are working on a .NET application. In our project, most of the interfaces use frames. We have a problem accessing previous page using frames. Let us say we have a page A that does not...
6
by: routeslip | last post by:
I'm refering to an entry in an array by it's string key, as in foo. Is there a way to get the numeric index of that array without iterating through the entire array? What I need to do is find...
2
by: gmccallum | last post by:
I have a data entry screen using controls bound through a bindingSource, TableAdaptor and a BindingNavigator to move through the records. When I have an data entry error (such as Null for a value)...
6
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table...
0
by: visionstate | last post by:
Hi All, I have a few tiny problems left with my cascading combo boxes. Here is what my form looks like: http://img219.imageshack.us/my.php?image=databaseformwl5.png The way it works is by...
2
by: DThreadgill | last post by:
Not sure how to begin with this one. My table consists of: Branch# (number, double) EntryDate (datetime, mm/dd/yyyy hh:mm:ss am/pm) One branch can have many entry dates (i.e, Branch # 76...
8
by: chandhseke | last post by:
I have a form with various fields, one of which I need to check against data in a database table. i.e if the value entered into the text input field exists in the database, the form should be...
11
by: JeremyI | last post by:
I am trying to make a form that mimics the action of a subform; i.e., when the user launches it (via a command button with the caption 'Programme...'), theoretically the new form is passed the value...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.