Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform showing last entry

Status
Not open for further replies.

smalty

Technical User
Jan 9, 2005
74
GB
I have a table containing information on vehicle fuel usage eg
Reg DateFuelIn Amount Cost Mileage

So there will be multiple entries for each Reg. The data is entered via a simple form. What I would like to do is show in that form (I guess as a subform) whatever was the last entry per Reg so that the user would have a quick check that the data they were about to enter was valid.....ie Mileage and DateFuelIn were valid based on the previous entry for that vehicle.
Would very much appreciate some guidance

Many thanks
 
How about basing the subform on the SQL below with Reg as the Link field.


[tt]SELECT Reg, DateFuelIn, Amount, Cost, Mileage
FROM Table
WHERE DateFuelIn = (
SELECT Max(DateFuelIn)
FROM Table A
WHERE A.Reg=Table.Reg)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top