Hi, I have some sql below which works great in itself, but it is not for want of a better word filtering the data as I require.
For example, say I have the following records below returned by the query:
Drill 1| Yard | 25/3/18
Drill 2 | Van | 18/3/18
Drill 3 | Van | 17/3/18
Drill 4 | Yard | 16/3/18
Ladders 1 | Yard | 22/3/18
Ladders 2 | Site | 21/3/18
Grinder 1 | Yard | 19/3/18
What I would like to do is for the query to look at the records and for each item i.e Drill1, Drill 2 etc and if the most recent date has a location matches a criteria in a combobox, i.e. Yard, then to return that record otherwise to ignore it.
I've looked at examples for MAX and TOP but they don't make a deal of sense.
Could someone look at my sql below please and see if it's feasible?
Many thanks, Lol
For example, say I have the following records below returned by the query:
Drill 1| Yard | 25/3/18
Drill 2 | Van | 18/3/18
Drill 3 | Van | 17/3/18
Drill 4 | Yard | 16/3/18
Ladders 1 | Yard | 22/3/18
Ladders 2 | Site | 21/3/18
Grinder 1 | Yard | 19/3/18
What I would like to do is for the query to look at the records and for each item i.e Drill1, Drill 2 etc and if the most recent date has a location matches a criteria in a combobox, i.e. Yard, then to return that record otherwise to ignore it.
I've looked at examples for MAX and TOP but they don't make a deal of sense.
Could someone look at my sql below please and see if it's feasible?
Code:
strSQL1 = "SELECT Tbl_Product.Part_No, Tbl_Product.Details, Tbl_Current_Location.Comments, Tbl_Current_Location.User, Tbl_Current_Location.Date_Loaned " _
& "FROM Tbl_Product INNER JOIN Tbl_Current_Location ON Tbl_Product.ID_Product = Tbl_Current_Location.ID_Product " _
& "Where Tbl_Current_Location.ID_Location_Type= " & Me.cboLocationCategory & ";"