Help to query only last updated date

S

Saz

Hello,

I need help on getting a list of Case ID with the very last updated
date.

Case Table (Case ID, Section ID, Section Update Date)
Sample
Case Table, Section ID, Section Update Date
1, A, 01/01/08
1, B, 01/15/08
1, C, 01/29/08
2, A, 02/26/08
2, C, 04/08/08

Each Case ID has multiple Section IDs. When the user change anything
in the Section, the system will automatically change the last updated
date of that section. Now I am looking for the list of Case ID with
the last updated date. I tried many different ways but for some reason
I could not able to get one to one result.

Expected Result (Case ID, Last Update Date)
Sample
Case ID, Last Update Date
1, 01/29/08
2, 04/08/08

Thank you,
Saz
 
K

Klatuu

You can find the most recent date using the DMax function:
Case Table (Case ID, Section ID, Section Update Date)

dim varMostCurrent As Variant

varMostCurrent = DMax("[Section Update Date]","[Case Table]", "[Section
ID] = """ & Me.txtSectionID & """ AND CaseID = " & Me.txtCaseID)
If IsNull(varMostCurrent) Then
MsgBox "No Records found for Case " & Me.txtCaseID & ", Section " &
Me.txtSectionID
End If
 
S

Saz

You can find the most recent date using the DMax function:
 Case Table (Case ID, Section ID, Section Update Date)

dim varMostCurrent As Variant

    varMostCurrent = DMax("[Section Update Date]","[Case Table]", "[Section
ID] = """  & Me.txtSectionID & """ AND CaseID = " & Me.txtCaseID)
    If IsNull(varMostCurrent) Then
        MsgBox "No Records found for Case " & Me.txtCaseID & ", Section " &
Me.txtSectionID
    End If
--
Dave Hargis, Microsoft Access MVP



Saz said:
I need help on getting a list of Case ID with the very last updated
date.
Case Table (Case ID, Section ID, Section Update Date)
Sample
Case Table, Section ID, Section Update Date
1, A, 01/01/08
1, B, 01/15/08
1, C, 01/29/08
2, A, 02/26/08
2, C, 04/08/08
Each Case ID has multiple Section IDs. When the user change anything
in the Section, the system will automatically change the last updated
date of that section. Now I am looking for the list of Case ID with
the last updated date. I tried many different ways but for some reason
I could not able to get one to one result.
Expected Result (Case ID, Last Update Date)
Sample
Case ID, Last Update Date
1, 01/29/08
2, 04/08/08
Thank you,
Saz- Hide quoted text -

- Show quoted text -

Thank you Dave ... and have a nice day =)
 

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

Similar Threads

Problem with NetworkDays ... Inconsistent results 0
macro help 1
parameter date question 3
Help w/Duplicates & Macros 5
Find then highlight in yellow 6
Delete Duplicates 2
last price query 2
Start and End date 2

Top