Results 1 to 5 of 5
  1. #1
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125

    Query design to show last stage

    Hello everyone,

    See my sales order list form design below:-

    Click image for larger version. 

Name:	sales order form.PNG 
Views:	17 
Size:	53.3 KB 
ID:	46072

    What I am trying to do is have the above form show the last stage as per the stage junction table. See sales order 1 example with the following stages associated:-

    Click image for larger version. 

Name:	sales order stages.PNG 
Views:	17 
Size:	12.9 KB 
ID:	46073

    See the query which is loading the form at the top:-



    Click image for larger version. 

Name:	qrySalesOrderFormStages.PNG 
Views:	17 
Size:	46.8 KB 
ID:	46074

    Can anyone suggest how I should modify my existing query to show the latest stage on sales order 1 which is "Despatch" to show on the sales order list form?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    not quite clear what you want - how does the second image relate to the first? What is sales order 1

    Only comment I can make at the moment is last does not mean latest, you need to apply an order which you may or many not be doing. Usually you would use Max

    perhaps you just need to apply a criteria to the stageID field for whatever it is for despatch.

  3. #3
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    Sorry, the very last record from the top image is sales order 1.

    Sales order 1 has from the second image a last stage as "Despatch".

    I am trying to make the stage control pull the latest stage per order.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,927
    Shouldn't you have an order for your status table?

    You could use MaxID perhaps, if your autonumber is incrementing?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    You should create another totals query based on tblJxStage table in which you Group By SalesOrderID and get the Max for Stage Date. Call this qryMaxStageDateOrderID.
    Now in your existing query bring this new query in and join it on SalesOrderID and StageDate to the tblJxStage and you should have what you want.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2017, 07:09 AM
  2. Replies: 1
    Last Post: 11-26-2014, 02:30 PM
  3. Two-stage query?
    By AlanH in forum Queries
    Replies: 2
    Last Post: 02-15-2014, 10:06 PM
  4. multi stage timer
    By jaykappy in forum Programming
    Replies: 5
    Last Post: 08-01-2013, 03:11 PM
  5. End User Stage
    By KevinMCB in forum Database Design
    Replies: 2
    Last Post: 03-02-2011, 10:47 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