473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to limit concurrent users/logins

Short: How can I limit the number of concurrent logins to Access
(2000) DB?

Long: I seem to be having the problem discussed in previous postings
of having more than 9 or 10 concurrent logins. If I can limit the
number of concurrent logins to 8 or 9, that would satisfy our needs.

Thanks

Nov 13 '05 #1
3 4436
As you have had no replies, I will give you 1 clue to a solution, but it's a
lot of work.

You will need a form that is opened when the db is opened that has a command
button "CloseDb" to close the db. It also needs a hidden text box called
"CloseOK". I use a modified Switchboard for this. you then set the OnUnload
of this form to
Private Sub Form_Unload(Can cel As Integer)

If CloseOK = 0 Then ' Must keep the switchboard open
DoCmd.CancelEve nt
End If
End Sub

So this means that the Db can not be closed unless the "CloseOK" Text Box
is set to true. This palaver ensures that if a user has logged in, they will
also by default log off.

I am going about this a bit arse about face, but never mind.

You need a table of Users
UserID PK
UserName No duplicates
LoggedOn True/False

Set up the users who are entitled to use the DB

you then need something like this on the open of the Switchboard (or
whatever the initial form is)

Function LogOn() ' Check who is logged on

Dim MyDb As Database
Dim UserSet As Recordset
Dim SQLStg As String

On Error GoTo LogOn_Err

SQLStg = "SELECT Count(Users.Use rID) AS CountOfUserID "
SQLStg = SQLStg & "FROM Users "
SQLStg = SQLStg & "GROUP BY Users.LoggedOn "
SQLStg = SQLStg & "HAVING (((Users.Logged On)=true));"

Set MyDb = CurrentDb
Set UserSet = MyDb.OpenRecord set(SQLStg) ' See how many using
program

With UserSet
If !CountOfUserID > 7 then
' maximum 8 users
MsgBox "You have exceeded the number of users licensed",
vbExclamation
RunCommand acCmdExit
End If
.Close
End With
Set UserSet = Nothing

SQLStg = "SELECT Users.* "
SQLStg = SQLStg & "FROM Users WHERE (Users.UserName = '" & CurrentUser()
& "');"
Set UserSet = MyDb.OpenRecord set(SQLStg)

If UserSet.BOF Then GoTo NoUser ' Not a valid
user

With UserSet
.Edit
!LoggedOn = True
.Update
.Close
End With
Set UserSet = Nothing
Exit Function

LogOn_Err:
If Err = 3021 Then ' No Current Record
UserSet.Close ' Close the query
Set UserSet = Nothing
Else
MsgBox Err.Description
End If
Exit Function

NoUser:
MsgBox "You have no permission to use this program", vbExclamation
'RunCommand acCmdExit

End Function

On pressing the "CloseDB" button you want something like

Function LogOff()

Dim MyDb As Database
Dim UserSet As Recordset
Dim SQLStg As String

On Error GoTo LogOff_Err

SQLStg = "SELECT Users.UserName, Users.LoggedOn "
SQLStg = SQLStg & "FROM Users WHERE (Users.UserName = '" & CurrentUser()
& "');"

Set MyDb = CurrentDb
Set UserSet = MyDb.OpenRecord set(SQLStg)

If UserSet.BOF Then Exit Function ' Can't find

With UserSet
.Edit
!LoggedOn = False
.Update
.Close
End With
Set UserSet = Nothing

Forms!Switchboa rd!CloseOK = 1 ' OK to
close database
RunCommand acCmdExit
End Function
Have fun

Phil
"mgPA" <ma************ *@gmail.com> wrote in message
news:11******** *************@l 41g2000cwc.goog legroups.com...
Short: How can I limit the number of concurrent logins to Access
(2000) DB?

Long: I seem to be having the problem discussed in previous postings
of having more than 9 or 10 concurrent logins. If I can limit the
number of concurrent logins to 8 or 9, that would satisfy our needs.

Thanks

Nov 13 '05 #2
Phil gave you an answer that will work well.

Another possibility is to read the ldb-file. (No need for an extra table)
Google on 'WhosOn' and you will find the code. Works beautiful.
Maybe you need to slightly adapt the function (or the way to use it) to your situation.

--
Hope this helps
Arno R
"mgPA" <ma************ *@gmail.com> schreef in bericht news:11******** *************@l 41g2000cwc.goog legroups.com...
Short: How can I limit the number of concurrent logins to Access
(2000) DB?

Long: I seem to be having the problem discussed in previous postings
of having more than 9 or 10 concurrent logins. If I can limit the
number of concurrent logins to 8 or 9, that would satisfy our needs.

Thanks

Nov 13 '05 #3
Thank you both.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3038
by: Steve | last post by:
I've run in to a problem with a query I'm trying to write. I have attached a sample SQL script at the end of this post to show an overview of what I'm working with. I want to be able to use LIMIT to control how many rows from one table are returned, independent of how many rows there are in a second table that is joined to the first. When I execute the following SQL script:
2
2158
by: SD | last post by:
Hi, Quick question, I have about 20 users in my local server and database. We are looking to restore that database to a new server in a new network and still be able to retain the database users. We have created all 20 logins in the new server (exact names) but when we restore the database I do not see the users anymore! Is there something we can do to preserve them or a script we can run to link
1
2849
by: Tom Ostberg | last post by:
There appears to be a limit of ~16378 user Id's possible per database. When adding users we eventually get the message: > exec sp_adduser 'testUser', 'testUser', 'user_group' Server: Msg 15065, Level 16, State 1, Procedure sp_grantdbaccess, Line 160 All user IDs have been assigned. All of the MSSQL procedures eventually call sp_grantdbaccess which has the following piece of code:
6
12347
by: Hannu | last post by:
Hi. In the ldb file you can see the users of the mdb-file. If you open the mdb-file your machine and username will be written in the lbd- file. Allthough you close the mdb-file your name won't disappear from the ldb-file, before every user has closed the mdb-file. I have heard that there will be problems if the amount of users will be over 10 in mdb-files. Is that true? Hannu
8
4016
by: pnp | last post by:
Hi all, I've developed a win C# app that is actually database driven using SQL server 2000. The idea is that only one application will be installed on a server in a network and the program will be able to run at each client machine by just double-clicking the application executable through a network share. The program supports user logins. What I want to do is find a secure way to control the number of concurrent *users* using the...
6
1420
by: Ross Lewis | last post by:
I would like to limit users from logging in to the website from more than one computer. I have a database that I use to check the username and password of the user, but I would also like to check if it is the same computer. How can this be done without using cookies?
6
3335
by: Bill Manring | last post by:
I have an ASP.NET application which my company sells comercially. We license on a concurrent user model, but we currently rely on the "honor" system for the customers to give us their best guess as to the maximum number of concurrent users they will need. We do this because, so far, we have not been able to come up with any mechanism for reliably monitoring how many users have active sessions and locking out users until a license becomes...
4
3338
by: Paul | last post by:
I have an ASP.NET application that I want to limit # of concurrent logins. Has anyone done similar things before? I was trying to increment a counter in the application and decrement the counter in "Session_End". However, the "Session_End" will only work for InProc session. So, is there any other approach? Thanks, Paul.
6
15402
by: krvrk | last post by:
Hi, I am creating a report for which i need to query a table for total number of users and Concurrent users logged in. The table will contain Username(nvarcar,not null),SessionStart time(datetime, not null), SessionEnd time (datetime,null), SessionID(int,not null) and ConnectGUID(uniqueidentifier, not null) etc can any one help me in finding total and number of concurrent logins per day. Sample Data
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7939
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8432
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8428
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8078
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.