Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dlookup help last value

Status
Not open for further replies.

bw2601

Technical User
Dec 16, 2004
29
US
I am trying to look up the last date entred into a table. the date is the primary key.

i want to compare the last date entered with the current date, and then display a message box if they match.

i have the message box done, that was the easy part, but now i seem to be having a lot of problems with dlookup. i have never used it before and could use some pointers in the right direction.

thanks in advance for any help.
 
You probably want to use DMax.

Code:
If DMax("[DateEntered]", "[tbl: My Table]") = Format(Now(), "Short Date") Then
    MsgBox "The last entry was today!"
Else
    'they didn't match
End If

You can reformat the date depending on how it's stored in your table.
 
to look at the last date entry look at Dmax instead of dlookup

 
Thank you so much, worked like a charm!!!

you rock!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top