how to resort a table from a module to extract firstrecord

  • Thread starter Thread starter Saida
  • Start date Start date
S

Saida

I have a table that with a Date field
What I need is after adding , deleting or editing the Date field from an
access module how do I resort the Date field to go to the first record
(earliest)

The type logic that I'm writing requires me to always get the earliest date

I have MS- Access 2000

Any hints, help is appreciated
 
If you just want the earliest date in the table, DMin() will retrive it.

This example gets the earliest date in a field named SaleDate in a table
named Table1:
=DMin("SaleDate", "Table1")

If you want to get the value of another field in the record that has the
lowest date, you could use the ELookup() function in this link:
http://members.iinet.net.au/~allenbrowne/ser-42.html
Use the expression:
=ELookup("MyOtherField", "Table1", , "SaleDate")
 
Thanks Allen


Allen Browne said:
If you just want the earliest date in the table, DMin() will retrive it.

This example gets the earliest date in a field named SaleDate in a table
named Table1:
=DMin("SaleDate", "Table1")

If you want to get the value of another field in the record that has the
lowest date, you could use the ELookup() function in this link:
http://members.iinet.net.au/~allenbrowne/ser-42.html
Use the expression:
=ELookup("MyOtherField", "Table1", , "SaleDate")
 
Ok, i found the earliest date the second question is how to got to the
record in order forme to modify a different field in the same record
 
To modify the field, you will need to execute an Update query statement, or
OpenRecordset() in code.
 
Back
Top