Use value from last record

jibb

Registered User.
Local time
Today, 02:02
Joined
Dec 1, 2011
Messages
93
Hello,

I need to return a value from the last record on a table to the current record on my form - how can I get the value to pull through?

Many Thanks
 
Hi,

In order to do this you need to have some field in the table that indicates the order the records were added (tables hold no sort order, and an autonumber ID can't be relied upon for true sequential numbering).

So, if you have some sort of timestamp or custom sequence field or for when the records were added, you could do a SELECT TOP 1 query with it ordered descending by the timestamp or custom sequence... that would give you the last record.

If you're talking about a form, and you want the last record you were on (which is not necessarily the same as the last added record), then you go about it by setting a form-scope variable, using OnCurrent to set/retrieve the value required.

hth
 

Users who are viewing this thread

Back
Top Bottom