Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    tagteam,

    No I wasn't really taking a dig at you. It was more that the concept --"it's pretty close so that's good enough" --reminded me of a new hire many years ago. We were discussing a verification validation scheme and he came up with a similar ---"well it covers most things"... He has since become quite "tenacious" in his approach to data management and most of it stemmed from a little discussion about borrowing money at the bank. Once we discussed the situation in terms of his bank account; his hard earned money... things took a different turn. The importance of a complete test -- became very important.
    Close is sufficient in those cases where you know certain conditions ---eg. only rolling stock to be accounted.



    PS.
    It sounds like there still may be something "wrong"/inefficient with your query(s).
    But you said
    the query does run quickly.
    and I think that was the original issue to be addressed. So if it runs quickly, and handles all required "cars"....
    Arvis' logic seems sound.

    You might want to post a copy of the database and query(s) with only a sample of the data. We don't need 5,000,000+ records.

    Good luck with your project.

    Update: I see Arvi has posted a revision to the query join in Post #17.
    Last edited by orange; 03-14-2018 at 02:48 PM. Reason: Arvi has adjusted the join set up

  2. #17
    Join Date
    Apr 2017
    Posts
    1,679
    Quote Originally Posted by tagteam View Post
    I have done as ArvilLaanemets suggested and the query does run quickly. However, the problem is that with the join it creates 1,097 copies of railcar 1 and 1,113 copies of railcar 2 etc... etc.... making the query huge. it should have about 4,200 records and ends up having 4,289,154 records.
    It looks like I hadn't best day today. OK, let's try again.

    Create a saved query
    Code:
    qLastDates = 
    	SELECT RailCarID, MAX(DateOfImport) AS [LastDate]
    	FROM FinalizedTraceData 
    	GROUP BY RailCarID
    Run a query
    Code:
    	SELECT ftd.DateOFImport, ftd.RailCarID, ftd.LocationCity, ftd.State 
    	FROM FinalizedTraceData ftd 
    		JOIN qLastDates ld ON ld.RailCarID = ftd.RailCarID AND ld.LastDate = ftd.DateOfImport
    I left half of join condition out! Btw, I think in Access is used JOIN instead of INNER JOIN (I'm too used to SQL Server syntax).

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,899
    Access use INNER JOIN, LEFT JOIN, RIGHT JOIN, not just JOIN alone.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    Join Date
    Apr 2017
    Posts
    1,679
    Quote Originally Posted by June7 View Post
    Access use INNER JOIN, LEFT JOIN, RIGHT JOIN, not just JOIN alone.
    OK. I was without Access at home computer, so there was not a way to check immediately. I remember some time ago I had issues when I used SQL syntax I'm used in SQL server in Access - probably it was then something like 'LEFT OUTER JOIN'.

  5. #20
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    I am working on a sample data set, I should be able to post it today.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 12-15-2017, 04:06 PM
  2. List box no longer showing latest entry
    By vector39 in forum Access
    Replies: 6
    Last Post: 06-08-2017, 11:02 AM
  3. Replies: 4
    Last Post: 07-04-2013, 12:07 PM
  4. Replies: 6
    Last Post: 08-24-2012, 12:04 PM
  5. Capturing Latest Entry on Subform
    By Marie1106 in forum Forms
    Replies: 3
    Last Post: 02-21-2012, 10:40 AM

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