Question : Dlookup top record with two criteria

Hi there,

I have a table called tblUserChanges. Within this table there are the following fields:
[Change] - Text
[ChangeDate] - DateTime
[Actioned] - YesNo
[UserID] - Number

I would like to get the latest [Change] value (using [ChangeDate]), where [Actioned] = True and [UserID]= Me.UserID

Please help! Cheers, LoveToSpod.

Answer : Dlookup top record with two criteria

Hello LoveToSpod,


MaxDate = DMax("[ChangeDate]", "[tblUserChanges]", "[Actioned] = True AND [UserID] = '" & Me.UserID & "'")
MsgBox DLookup("[Change]", "[tblUserChanges]", "[ChangeDate] = #" & MaxDate & "# AND [UserID] = '" & Me.UserID & "'")


Regards,

Patrick
Random Solutions  
 
programming4us programming4us