find last recorded date in a table (1 Viewer)

puthenveetil

Registered User.
Local time
Today, 19:43
Joined
Aug 9, 2004
Messages
94
Hi all,

I have a problem finding the last date entered in a table..The purpose is to find the record which entered last in a table. Is there any way to find the last record with date ? I am attaching a sample db with this. Please look that if my question is not clear here..


Thanks in advance

thanks
 

Attachments

Do you mean the latest date in the table ie max date or the date of the last record entered ie Last date ?

I would use a query and base the form on that selecting the date field with appropriate aggregate function. Oh and I wouldn't use date as afield name it is a functionname and will cause you problems in the long term.

Brian
 
Hi Brian,

I would like to find the last updated date in a field.


thanks
 
Then you use Last. Your query is simple

SELECT Last(Table1.date) AS LastOfdate
FROM Table1;

then base your form on this query, this will give you the last date entered into the table.

Brian
 
Last might not give you the correct record, you should use Max on the date field
 
Just got back to the forum and feel that I should apologise for the stupidity of my last response, I'll blame a senior moment :o
I never use Last but am puzzled by Pat's answer and hope that she can find time in her busy life to clarify for me.

Quote from Pat
Last() returns the last record in the recordset. This has nothing to do with ............, the last added record
,

What do you mean by the last record, I was not aware that the tables had the concept of the last physical record?


Quote from ACCESS help
You use the First or Last functions to return the first or last record in the group you are performing calculations on. These functions return the first or last record as it was entered in chronological order. Sorting the records has no effect on these functions.

This implies, atleast to me and testing suggests that it is correct, that I could use Last to find the last record added in any group of records, which I feel is the same as using Max on Autonum. I'm not suggesting this is the way to go , one should design a more positive approach but occasionally one inherits poor design.

Brian
 
Last edited:
Thank you for replying Pat.
My quote was from Access help Answer wizard "aggregate functions" then select "about calculations in a query" then you can read abot First and Last.

However having read your response I think I will continue not to use these functions opting to get what I want by design.

Brian
 
I'm guessing that you're in VBA , I'm not.
Does that make sense?
just tried it for myself as one should :) , but could only find Dfirst Dlast.

Brian
A2002 SP3
 

Users who are viewing this thread

Back
Top Bottom