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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

See who is logged on your database 10

Status
Not open for further replies.

Dumboy

Technical User
Feb 29, 2000
97
US
In the search for answers in my quest to make Access do what I want to do I stumbled into this cool free application that alouds you to see who is currently logged on your application so you can kick them out before backing up or re-designing. It consist of one form and two modules that you just dump into your existing application and just works.<br>
<br>
The direct link to the application is:<br>
<A HREF=" TARGET="_new"><br>
The link to the creators page is:<br>
<A HREF=" TARGET="_new"><br>
I think is really good and saves you all the coding.<br>
<br>
In and out ...(the way it should be...)<br>
Dumboy.......! OUCH....!
 
Groovey<br>
Thanks <p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
great,thanks alot. <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Ok, I'll ask the question....How do you boot (kick) a user off of the system?<br>
<br>
I'm currently using Win NT and have User permissions on my network though I have admin permissions on my 'puter.<br>
<br>
I was testing the program with someone with Admin permissions on the network... <p> <br><a href=mailto: > </a><br><a href= Eclectic Page</a><br>
 
I guess you have to call them and tell them..... it wouldn't be a good idea to just kick them out.... But I guess you could create a macro and/or VBCode that calls a POP Up window asking the users to GET THE HECK OUT OF YOUR APPLICATION .... or you'll have Bill Gates take care of them....<br>
<br>
Or just wait until nobody is using it then.... open the Dbase on Exclusive mode and do your thing.....<br>
<br>
Ohh!...my head....<br>
<br>
Later.<br>
<br>
Dumboy......! OUCH!...... it hurts to think......
 
Dumboy's suggestion (the macro one) could be implemented by using form's On Timer event. If admininstrator wanted people out, he/she would open the database and set certain variable or table field value true or false. On Timer would constantly check this value and if true the pop-up window would appear. And of course AutoOpen macro would check this 'GET THE HECK OUT OF MY APPLICATION' -variable at startup to prevent new users. <br>
<br>
Feel free to write the code,<br>
Al
 
Al, I like your idea. Doesn't a form have to already be open for an event (like timer) to be triggered? I'm wondering how to make sure the form is open and the message is noticable to the users. Maybe open it as invisible on Startup, then make it get focus and become visible when the timer notices the trigger event? But I don't know what happens to any other processes that may be happening when this occurs - running a query, previewing or printing a report, runnng code, enting data in a form, etc. <br>
<br>
Another great utility function for those users who like to leave the app open when they leave for the day would be if I could remotely close the db safely.
 
this will do the trick:

Create a table &quot;tblKickedUsers&quot; with two fields:
strUser text
ysnKicked yes/no

and change/add this code to the form frmSecurity:

Private Sub Form_Timer()
''' Call security routine
GetSecurityInfo
CheckIfSomebodyKickedMyButt
End Sub
Private Sub lstUser_DblClick(Cancel As Integer)
Dim rs As Recordset
If lstUser.ItemsSelected.Count >= 1 Then
Set rs = CurrentDb.OpenRecordset(&quot;select * from tblKickedUsers where strUser='&quot; &amp; lstUser.Column(0) &amp; &quot;'&quot;, dbOpenDynaset)
If Not rs.EOF Then
rs.Edit
Else
rs.AddNew
rs.Fields(&quot;strUser&quot;) = lstUser.Column(0)
End If
rs.Fields(&quot;ysnKicked&quot;) = True
rs.Update
rs.Close
Set rs = Nothing
End If
End Sub
Sub CheckIfSomebodyKickedMyButt()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset(&quot;select * from tblKickedUsers where [strUser]='&quot; &amp; CurrentUser() &amp; &quot;'&quot;, dbOpenSnapshot)
If Not rs.EOF Then
If rs.Fields(&quot;ysnKicked&quot;) = True Then
Application.Quit
End If
End If
rs.Close
Set rs = Nothing
End Sub
 
Thanks. There ais a free little utility at fmsinc.com that is supposed to do all this nicely. But I've checked it a few times and the last time (about 6 months ago) it still didn't work properly for a secured db (and all mine are secured) ... but it was so close!
 
I like to have the sourcecode of this kind of functionality.
These other little tools always leave a lot of things open with no way to change it yourself.
 
Why is it that sometimes when I run this, I get not only the users that are connected to the database, but also about six or seven entries identified as the name of the machine that the database is hosted on? Any ideas?
 
Geat One, Thanks.
 
ok....i thought this question would have been asked...but i did not see it...so here goes......i'm running a novel server with the privlages properly distibuted...how ever....on every workstation i goto it comes up with the user name as admin....i wouldn't worry so much however, i do have buttons on certain forms that or visible and not visible under certain names and i'm not all to good with coding.....so could someone tell me how to make it so the security form displays the name of the user integrated with novel? ...I AM THE EGGMAN!!!
 
Apparently you did not configure your security system at all. Since this is a quite complicated issue, you should absolutely read the MS whitepaper on security as well as the security-related articles in the Access Online Encyclopedia (
The correct strategy in two words:
Each copy of your application (frontend) has to refer to a certain MDW file (via shortcut). This file contains the usernames/passwords/rights...
If you do not use a shortcut then the STANDARD.MDW (in the windows\system folder) is used to open your application. The standard user's name is ADMIN.
Since your application is not properly secured it is possible for everybody to open it without problems.
 
Actually...the security system is configured on my NOVELL SERVER....but i did not assign &quot;user/groups accounts permissions&quot; in Access. And i will not. This is just a simple question and am hoping for a simple answer....The form included in the database' zip file &quot;frmSecurity&quot; has a field called &quot;MACHINE&quot; and points to the User's Computer Name. I would liek to know if i can make the module point the User's NAME on HIS COMPUTER..rather than look for a log on name or user account inside access. ...I AM THE EGGMAN!!!
 
To get the user's Network name that they logged onto the PC with, use Environ(&quot;UserName&quot;), this will return the Network name of whoever is logged onto the PC.

Hope this helps...

Kyle ::)
 
Kyle! I love help and all....but I'm clueless yet as to things about VB and programming...I AM LEARNING THO....if you could tell me where inside the module i will need to place that line of code...it would be helpfull or even wrtie what i'm gonna need to put. ...I AM THE EGGMAN!!!
 
Jarnut00,
If you could post your code I could tell you EXACTLY what changes would need to be made, but without that all I can really tell you is that if you're trying to populate a field with the logon name you will need a line of code somewhere that looks like this:

[YourFieldName] = Environ(&quot;UserName&quot;)

I really can't be more specific without knowing exactly what you're trying to do, but if you could paste the module, I could be of much more help.

Kyle ::)
 
Putting the simple function call into a module merely will repackage the function call. Somewhere, wherever you want to use it merely enter the call to environ. You could do this from almost anywhere you can call the CurrentUser.

-----------------------------------
Dim strNetname As String
strNetname = Environ(CurrentUser)

OR---------------------------------
Public Function GetNetname(Username As String) As String
GetNetName = Environ(Username)
End Function

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top