Help to query only last updated date

  • Thread starter Thread starter Saz
  • Start date Start 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
 
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
 
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 =)
 
Back
Top