how to resort a table from a module to extract firstrecord

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
 
A

Allen Browne

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")
 
S

Saida

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")
 
S

Saida

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
 
A

Allen Browne

To modify the field, you will need to execute an Update query statement, or
OpenRecordset() in code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top