PDA

View Full Version : Help with date function


dlbdennis
06-26-2003, 02:55 PM
I have a table with multiable entrys for each user. The two fields
I'm working with is fldUserName and fldDate, both fields are text.
This table is a log that is updated everytime a user logs in. I need
to display the last date a user loged in and can't seem to get it...

SELECT DISTINCT Table2.fldUserName, table2.fldDate

And I'm lost from there???

:think:

Bullschmidt
06-27-2003, 12:52 AM
Well if the field containing the date were really a date you could do a totals query (View | Totals in query design mode) and then group on the user and do max on the date.

Otherwise maybe you can do CDate() or something in a calced field (not really sure here)...

jsawkang
06-27-2003, 12:54 AM
hi...

what u want to do first anyway?

dlbdennis
06-27-2003, 09:33 AM
What I'm wanting to do is show the last date from a list of dates that a user loged in. I have a code that I use to display all the user names and a graph of the number of logins. Now I'm wanting to add the last date of login for each user.

Bullschmidt
06-29-2003, 12:08 AM
How about something like this (and of course you might modify the field names):

SELECT tblInv.InvUserID, Count(tblInv.InvID) AS CountOfInvID, Max(tblInv.InvDt) AS MaxOfInvDt
FROM tblInv
GROUP BY tblInv.InvUserID;

dlbdennis
06-29-2003, 12:27 AM
Thanks that works like a champ.

Bullschmidt
06-29-2003, 12:43 AM
Glad to hear it works for you. I too like the idea of a login log report.

dlbdennis
06-29-2003, 12:56 AM
I'm supprised more of these login scripts that are around don't have tracking with them.