Re: PLEASE HELP WITH LOG IN FEATURE



Hi John,

Thanks for your fast response. Yes, I do have a security set up in Access.
Speaking of setting up security in Access, after the security has set up on
the FE, no one can open the FE from Windows Explorer and the FE is secured
(What does it mean by secured?)? I have created security feature on a few FE
and I still can open and get into them through Windows Explorer.

As far as the log in feature from my original post, I am a little confused
on the following query:

UPDATE logRecords SET logout = Login WHERE Logout is Null and USERID =
"CurrentUserID"

Do I need that query? What is the purpose of this query? It appears to me
that it is setting the logout time with login time.

Thanks.


"John Spencer" wrote:

Yes those are two queries and need to be run separately.

This one creates a record

INSERT INTO tblLogInActivities (LogInBy , LogInTime)
Values (currentuser() , now())

This one updates existing records

UPDATE tblLogInActivities SET LogOutTime = LogInTime
WHERE LogOutTime is null and LogInBy = CurrentUser()

By the way, unless you have implemented Access Security, CurrentUser() is
going to return "Admin" every time.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"AccessHelp" <AccessHelp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:84DFAB3C-3EA4-4755-9F6D-E037C87A6B23@xxxxxxxxxxxxxxxx
Hi John,

I just tried creating your first query, and I was getting a syntax error
"missing operator". Below is my sql code.

UPDATE tblLogInActivities SET LogOutTime = LogInTime WHERE LogOutTime is
null and LogInBy = CurrentUser()
INSERT INTO tblLogInActivities (LogInBy , LogInTime) Values (currentuser()
,
now())

Did I miss something?

Thanks.

"John Spencer" wrote:

I would use a form that opens on startup and has its visible property set
to
no.

In the on open code I would execute a query that set any null logout
times
for the relevant loginid to the login time for that record
UPDATE logRecords SET logout = Login WHERE Logout is Null and USERID =
"CurrentUserID"
INSERT INTO LogRecords (USERID, Login) Values("CurrentUserID", Now())

Then keep the form open (with its visible property set to NO).
When the form gets closed (that entire database is closed) use vba code
to
update the relevant record

UPDATE logRecords
SET logout = Now()
WHERE Logout is Null and USERID = "CurrentUserID"


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"AccessHelp" <AccessHelp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6E04D218-6DEC-49BD-B671-EE77EDB3F09C@xxxxxxxxxxxxxxxx
Good morning,

I have a table (Table A) for which I created to keep track of who has
been
logging in and out of the database. In the table, I have 3 fields:
LogInBy,
LogInTime and LogOutTime.

I would like the database to keep track of who (LogInBy) and when
(LogInTime) in that table when a user is logging in and the database is
opened. At the same time, when the user leaves the database, I would
like
the database to have the time populated in the LogOutTime field on the
same
record as LogInBy and LogInTime. For example, when I log in to the
database,
the database will create a new record (Record 3) in Table A, and when I
leave
the database, the database will populate the time in the LogOutTime
field
of
Record 3.

Should I use the Append query in On Load event of the Main Menu form?
If
I
do that, a new record will be created whenever the users return to the
Main
Menu from other forms.

Thanks.






.



Relevant Pages

  • Re: User security for ~120 organizations
    ... rather than using the Security Wizard. ... > - populate the field in the tables with the value of CurrentUser() ... > - use CurrentUserin your queries to restrict the records that are ... >>and only one person from that organization can be in the database at a time. ...
    (microsoft.public.access.security)
  • Re: Multiusers in a workgroup
    ... Security on your database, then the CurrentUser() function will return ... logged-in user. ...
    (microsoft.public.access.gettingstarted)
  • Re: PLEASE HELP WITH LOG IN FEATURE
    ... database without updating the logout time. ... In most cases the query would actually do nothing. ... UPDATE logRecords SET logout = Login WHERE Logout is Null and USERID = ...
    (microsoft.public.access.modulesdaovba)
  • Re: PLEASE HELP WITH LOG IN FEATURE
    ... "John Spencer" wrote: ... to catch OLD records for the current user that have no logout time. ... database without updating the logout time. ... UPDATE logRecords SET logout = Login WHERE Logout is Null and USERID = ...
    (microsoft.public.access.modulesdaovba)
  • Re: PLEASE HELP WITH LOG IN FEATURE
    ... I would use a form that opens on startup and has its visible property set to ... In the on open code I would execute a query that set any null logout times ... Then keep the form open (with its visible property set to NO). ... When the form gets closed (that entire database is closed) use vba code to ...
    (microsoft.public.access.modulesdaovba)