469,917 Members | 1,489 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

How do I create a table to log users that the application has booted out

I have had most of my questions answered in this forum and learned a lot
from reading others post. In fact, I have even discovered answers to
questions that I thought were totally impossible and absurd to ask, and for
that I will continue to be a fan to this NG.

Today I have one question (two parts): How do I create a table to log users
that the application has booted out ? Does it log the users by computer name
?

Thanks very much.

Omey
Nov 12 '05 #1
8 1629
"Omey Samaroo" <no****@replytogroup.com> wrote in message news:<rf*******************@news01.bloor.is.net.ca ble.rogers.com>...
I have had most of my questions answered in this forum and learned a lot
from reading others post. In fact, I have even discovered answers to
questions that I thought were totally impossible and absurd to ask, and for
that I will continue to be a fan to this NG.

Today I have one question (two parts): How do I create a table to log users
that the application has booted out ? Does it log the users by computer name
?

Thanks very much.

Omey

Define "booted out". Without understanding what that means, I'm not
sure anyone can answer your question.
Nov 12 '05 #2
Thanks for pointing that out, Pieter
Okay, I now use a hidden form with a timer control to close the database if
a user is inactive for 10 minutes (learned at this forum)
What I would like to do next is find out which users were closed by this
method and store the info in a table. Is this at all possible?
(Hope that I explained it a little better)

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"Omey Samaroo" <no****@replytogroup.com> wrote in message

news:<rf*******************@news01.bloor.is.net.ca ble.rogers.com>...
I have had most of my questions answered in this forum and learned a lot
from reading others post. In fact, I have even discovered answers to
questions that I thought were totally impossible and absurd to ask, and for that I will continue to be a fan to this NG.

Today I have one question (two parts): How do I create a table to log users that the application has booted out ? Does it log the users by computer name ?

Thanks very much.

Omey

Define "booted out". Without understanding what that means, I'm not
sure anyone can answer your question.

Nov 12 '05 #3
Thanks for the tip Chuck & Pieter, cheers
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:3p********************************@4ax.com...

Write to a "log" file somewhere indicating that. See Access Help on
the OPEN statement for more information.

On Fri, 05 Dec 2003 06:42:02 GMT, "Omey Samaroo"
<no****@replytogroup.com> wrote:
Thanks for pointing that out, Pieter
Okay, I now use a hidden form with a timer control to close the database ifa user is inactive for 10 minutes (learned at this forum)
What I would like to do next is find out which users were closed by this
method and store the info in a table. Is this at all possible?
(Hope that I explained it a little better)

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google. com...
"Omey Samaroo" <no****@replytogroup.com> wrote in message

news:<rf*******************@news01.bloor.is.net.c able.rogers.com>...
> I have had most of my questions answered in this forum and learned a lot > from reading others post. In fact, I have even discovered answers to
> questions that I thought were totally impossible and absurd to ask,
andfor
> that I will continue to be a fan to this NG.
>
> Today I have one question (two parts): How do I create a table to log

users
> that the application has booted out ? Does it log the users by
computername
> ?
>
> Thanks very much.
>
> Omey
Define "booted out". Without understanding what that means, I'm not
sure anyone can answer your question.

--
When You Come To The End Of Your Rope, Tie A Knot In It And Hang On!

Nov 12 '05 #4
"Omey Samaroo" <no****@replytogroup.com> wrote in message news:<_M********************@news04.bloor.is.net.c able.rogers.com>...
Thanks for pointing that out, Pieter
Okay, I now use a hidden form with a timer control to close the database if
a user is inactive for 10 minutes (learned at this forum)
What I would like to do next is find out which users were closed by this
method and store the info in a table. Is this at all possible?
(Hope that I explained it a little better)


Oh, now it makes sense. Sure, before you shut the database, you'd
write the person's userid or whatever to a table, the time they were
kicked out, and a reason. Just open a recordset and add the records
you want and then update.

Username... that's at mvps.org/access (Accessweb).
The time: just use Now()
The reason: from that form, you'd just set it to "Inactive Timeout" or
something and then append the record.

Of course, you could use cnn.Execute strSQL or currentdb.execute
strsql... (if you build the insert string on the fly.
Nov 12 '05 #5
Awesome, thanks for the suggestions Pieter. I will admit that some of it is
a little over my head, but I will do some research and ask more questions if
I get stuck.

Omey

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf*************************@posting.google.co m...
"Omey Samaroo" <no****@replytogroup.com> wrote in message

news:<_M********************@news04.bloor.is.net.c able.rogers.com>...
Thanks for pointing that out, Pieter
Okay, I now use a hidden form with a timer control to close the database if a user is inactive for 10 minutes (learned at this forum)
What I would like to do next is find out which users were closed by this
method and store the info in a table. Is this at all possible?
(Hope that I explained it a little better)


Oh, now it makes sense. Sure, before you shut the database, you'd
write the person's userid or whatever to a table, the time they were
kicked out, and a reason. Just open a recordset and add the records
you want and then update.

Username... that's at mvps.org/access (Accessweb).
The time: just use Now()
The reason: from that form, you'd just set it to "Inactive Timeout" or
something and then append the record.

Of course, you could use cnn.Execute strSQL or currentdb.execute
strsql... (if you build the insert string on the fly.

Nov 12 '05 #6
"Omey Samaroo" <no****@replytogroup.com> wrote in message news:<N6*********************@twister01.bloor.is.n et.cable.rogers.com>...
Awesome, thanks for the suggestions Pieter. I will admit that some of it is
a little over my head, but I will do some research and ask more questions if
I get stuck.

Omey


Okay, the stuff from MS...
http://support.microsoft.com/default...B;en-us;128814

Sub IdleTimeDetected (ExpiredMinutes)
Application.Quit acSaveYes
End Sub

You'd just tweak this...

Sub IdleTimeDetected (ExpiredMinutes)
'See below for code...

Call LogKickOut
Application.Quit acSaveYes
End Sub

Okay... a "helper" function:
API: Get Login name
Author(s)
Dev Ashish
http://www.mvps.org/access/api/api0008.htm

(Q) How do I retrieve the UserName with which the user is logged into
the network?

(A) Paste the following code in a new module and call the function
fOSUserName.
'******************** Code Start **************************
' This code was originally written by Dev Ashish. ' It is not to be
altered or distributed,' except as part of an application. ' You are
free to use it in any application, ' provided the copyright notice is
left unchanged.'' Code Courtesy of ' Dev Ashish'

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************
Okay, here's the code:

Public Sub LogKickouts()
Dim strSQL As String

strSQL = "INSERT INTO KickedOutUsers ( UserName, Reason ) VALUES
('" & fOSUserName & "', 'Idle Too long');"
DBEngine(0)(0).Execute strSQL

End Sub
Nov 12 '05 #7
Pieter, in this instance I am not using usernames but ComputerNames as all
users share the main database password.
I copied and created a module from Dev
******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSMachineName() As String
'Returns the computername
Dim lngLen As Long, lngX As Long
Dim strCompName As String
lngLen = 16
strCompName = String$(lngLen, 0)
lngX = apiGetComputerName(strCompName, lngLen)
If lngX <> 0 Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = ""
End If
End Function
'******************** Code End **************************

but now how do I use it to create the table and write the computer name and
date/time that it was closed for inactivity ?

Omey
"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"Omey Samaroo" <no****@replytogroup.com> wrote in message

news:<N6*********************@twister01.bloor.is.n et.cable.rogers.com>...
Awesome, thanks for the suggestions Pieter. I will admit that some of it is a little over my head, but I will do some research and ask more questions if I get stuck.

Omey


Okay, the stuff from MS...
http://support.microsoft.com/default...B;en-us;128814

Sub IdleTimeDetected (ExpiredMinutes)
Application.Quit acSaveYes
End Sub

You'd just tweak this...

Sub IdleTimeDetected (ExpiredMinutes)
'See below for code...

Call LogKickOut
Application.Quit acSaveYes
End Sub

Okay... a "helper" function:
API: Get Login name
Author(s)
Dev Ashish
http://www.mvps.org/access/api/api0008.htm

(Q) How do I retrieve the UserName with which the user is logged into
the network?

(A) Paste the following code in a new module and call the function
fOSUserName.
'******************** Code Start **************************
' This code was originally written by Dev Ashish. ' It is not to be
altered or distributed,' except as part of an application. ' You are
free to use it in any application, ' provided the copyright notice is
left unchanged.'' Code Courtesy of ' Dev Ashish'

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************
Okay, here's the code:

Public Sub LogKickouts()
Dim strSQL As String

strSQL = "INSERT INTO KickedOutUsers ( UserName, Reason ) VALUES
('" & fOSUserName & "', 'Idle Too long');"
DBEngine(0)(0).Execute strSQL

End Sub

Nov 12 '05 #8
"Omey Samaroo" <no****@replytogroup.com> wrote in message news:<bT******************@news02.bloor.is.net.cab le.rogers.com>...
Pieter, in this instance I am not using usernames but ComputerNames as all
users share the main database password.
but now how do I use it to create the table and write the computer name and
date/time that it was closed for inactivity ?

Omey

Sub IdleTimeDetected (ExpiredMinutes)
'See below for code...

Call LogKickOuts '<----------THIS LOGS THE KICKOUT.
Application.Quit acSaveYes
End Sub

Okay, here's the code:

Public Sub LogKickouts() 'WRITE THE KICKOUT TO THE TABLE. Dim strSQL As String

strSQL = "INSERT INTO KickedOutUsers ( UserName, Reason ) VALUES
('" & fOSUserName & "', 'Idle Too long');"
DBEngine(0)(0).Execute strSQL

End Sub

Nov 12 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Lauren Quantrell | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.