Results 1 to 5 of 5
  1. #1
    Anugerah is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2018
    Posts
    15

    Querry list unsuitable record

    Hi there..

    I have an issue with querry
    I want it to show the latest hourmeter recorded for each equipment.
    But for unknwon reason it show hourmeter from other date.

    For example inventory number A13001 got hourmeter 515.5 on the querry.


    It should get 549.9 from date 2018/10/18 according to the equipment maintenance table

    Some of them got the correct hourmeter on the querry. But other ones don't.

    Please anyone advice what to do.

    I have another solution. I could have made another querry that show the latest ID. Then, I would need Dlookup function to call fitted hourmeter with same ID criteria. But I keep failing to create the Dlookup function.

    Thank you in advance.

    i uploaded the access file on GDrive:
    https://drive.google.com/file/d/1NJx...ew?usp=sharing


    Click image for larger version. 

Name:	B.jpg 
Views:	14 
Size:	75.1 KB 
ID:	35897Click image for larger version. 

Name:	A.jpg 
Views:	14 
Size:	62.4 KB 
ID:	35898

  2. #2
    Anugerah is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2018
    Posts
    15
    Here is the design of the querry
    Click image for larger version. 

Name:	C.jpg 
Views:	14 
Size:	212.1 KB 
ID:	35899

  3. #3
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Try it this way. Not sure you want the ID there at all. The ID is not always reliably going to be the "Latest Record".
    Click image for larger version. 

Name:	max.JPG 
Views:	10 
Size:	51.0 KB 
ID:	35900

  4. #4
    Anugerah is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jan 2018
    Posts
    15
    Quote Originally Posted by davegri View Post
    Try it this way. Not sure you want the ID there at all. The ID is not always reliably going to be the "Latest Record".
    Click image for larger version. 

Name:	max.JPG 
Views:	10 
Size:	51.0 KB 
ID:	35900
    Thanks Dave

    But I did not set the hourmeter to max because there is certain case the hourmeter is reset to 0.

    So I don't need it to show the largest amount of hourmeter.
    I need it to show the latest hourmeter recorded for every equipment instead.

  5. #5
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    The problem appears to be with LAST.
    I don't know why it wants to select the record with Hourmeter reading 515.5 when the record with Hourmeter reading 549.9 has a higher ID, so was created later.
    To illustrate:
    Click image for larger version. 

Name:	q1.png 
Views:	7 
Size:	13.9 KB 
ID:	35914
    SELECT Last([Equipment Maintenance].Hourmeter) AS LastOfHourmeter, [Equipment Maintenance].Equipment, [Equipment Maintenance].ID
    FROM [Equipment Maintenance]
    GROUP BY [Equipment Maintenance].Equipment, [Equipment Maintenance].ID
    HAVING Last([Equipment Maintenance].Hourmeter)>525 AND [Equipment Maintenance].Equipment=21;
    Last edited by davegri; 10-20-2018 at 12:35 PM. Reason: added query to show

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 02-04-2016, 05:10 PM
  2. Querry from a multivalue list
    By TOMMY.MYERS668 in forum Queries
    Replies: 6
    Last Post: 08-09-2013, 01:06 PM
  3. Replies: 4
    Last Post: 07-03-2013, 10:02 AM
  4. Replies: 3
    Last Post: 08-26-2012, 10:04 PM
  5. Querry to automate previous record HELP!
    By rajgoyal00 in forum Queries
    Replies: 9
    Last Post: 12-15-2011, 03:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums