How to get latest record for item

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table 'tblVehicles' which holds 'dispositions' for each vehicle. I
need to display only vehicles that hold the 'disposition' of available. My
problem is I get several records for each vehicle. For example the table
holds 'dispositiondate' and 'disposition' so everytime a record is entered
with a disposition of available, it shows in my form. I only want the last
entry.

So, I was thinking of using DLast such as :

DLast("[Disposition]","tblDispositions","[VehicleNumber]="&_
[Forms]![frmVehicleDispositions]![VehicleNumber])

Question is, how would I add the second argument to show vehicle with a
'disposition' of 'available'

Thanks in advance
 
Paul B. said:
I have a table 'tblVehicles' which holds 'dispositions' for each vehicle. I
need to display only vehicles that hold the 'disposition' of available. My
problem is I get several records for each vehicle. For example the table
holds 'dispositiondate' and 'disposition' so everytime a record is entered
with a disposition of available, it shows in my form. I only want the last
entry.

So, I was thinking of using DLast such as :

DLast("[Disposition]","tblDispositions","[VehicleNumber]="&_
[Forms]![frmVehicleDispositions]![VehicleNumber])

Question is, how would I add the second argument to show vehicle with a
'disposition' of 'available'


You should use DMax instead of DLast.

You never explained how the form got involved in the
criteria of the query, but I think the dispositiondate
field's criteria should be:

DMax("dispositiondate","tblDispositions","VehicleNumber=" &
tblVehicles.VehicleNumber & " And Disposition='available'")
 
Back
Top