Trying to keep certain units together

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CoreyReynolds
    New Member
    • Nov 2009
    • 29

    Trying to keep certain units together

    Hello, so I'm not sure how to go about this.

    My table is below: Each piece of equipment we have has an equipmentID, and can have multiple Compartments (parts in the machine), which are dueIn (due to be inspected) in a certain number of hours of use.

    So, I want to go through the list, find the lowest "dueIn" reading for a piece of equipment with the Compartment "Engine", list it first, then all of the other compartments belonging to that equipment. Then find the next lowest engine compartment, and list all of the other parts from that piece of equipment and so on.

    So all of the compartments in a piece of equipment need to stay together in a group, and I need those groups sorted by the "DueIn" value for that piece of equipments engine.

    Sorry if I made that too complicated, if that doesn't make sense let me know and I'll try to re clarify.

    Code:
    equipmentID lastEntry reading code	dueIn	Compartment OD
    28178	1/4/2010	47905	C	95	Transmission	17524
    28191	1/12/2010	35758	C	-1444	Engine	17525
    28206	1/11/2010	41182	C	-714	Engine	17526
    28508	1/10/2010	26414	C	-416	Engine	17527
    30714	1/9/2010	11956	C	71	Transmission	17528
    30714	1/9/2010	11956	C	32	Differential	17529
    31070	1/9/2010	17000	C	-480	Engine	17530
    31070	1/9/2010	17000	C	-586	Differential	17531
    31070	1/9/2010	17000	S	-480	Hydraulics	17532
    31070	1/9/2010	17000	S	-589	Coolant	17533
    31192	1/12/2010	13294	C	62	Engine	17534
    31192	1/12/2010	13294	S	62	Hydraulics	17535
    31192	1/12/2010	13294	S	62	Coolant	17536
    31362	1/12/2010	9693	C	72	Engine	17537
    31362	1/12/2010	9693	S	72	Coolant	17538
    31384	10/19/2009	61915	C	-1915	Transmission	17539
    31384	10/19/2009	61915	C	-1915	Differential	17540
    31384	10/19/2009	61915	C	-1915	Rear Differential	17541
    31384	10/19/2009	61915	S	-31915	Coolant	17542
    31509	1/11/2010	983	C	17	Transmission	17543
    31509	1/11/2010	983	S	58	Differential	17544
    31509	1/11/2010	983	S	58	Rear Differential	17545
    I could do something in VBA if needed, but I kind of wanted to keep it all as one query if possible.
Working...