Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / March 2006

Tip: Looking for answers? Try searching our database.

Code to Choose Multi/Single User

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Russ Scribner - 07 Mar 2006 19:23 GMT
Hello,

I am currently working on an application that uses a license key (made up by
me) to determine whether the user has rights for a single user or a
multi-user license. I have split the database and would like to allow the
user to put the BE on their server while their FE is on their workstation.
The question is how I can keep the user from connecting to the BE with
multiple FE on seperate workstations if they only have a license to connect
with one FE.

My idea is that I could have the program check their license key and if they
only have rights to open the database with a single workstation I could
change their logon to exclusive. In my mind that would keep other FE from
connecting. Is there a way to do that programatically? Any other ideas?

Thanks...
Signature

Russ Scribner

Jesper F - 07 Mar 2006 22:35 GMT
> I am currently working on an application that uses a license key (made up
> by
[quoted text clipped - 11 lines]
> change their logon to exclusive. In my mind that would keep other FE from
> connecting. Is there a way to do that programatically? Any other ideas?

Maybe you could check to see if other are logged into the BE when a
workstations tries to connect.
If others are using the BE you can deny access.
There are ways to get a list of the users that are using a the BE.
Maybe that's a way to go.

Jesper Fjølner
Russ Scribner - 07 Mar 2006 22:53 GMT
Thanks Jesper,

I'm looking into using the WhosOn() function that I found on several
websites to look at how many are logged into the ldb on the BE. Is that what
you were referring to?
Signature

Russ Scribner

> > I am currently working on an application that uses a license key (made up
> > by
[quoted text clipped - 19 lines]
>
> Jesper Fjølner
Graham R Seach - 09 Mar 2006 12:23 GMT
Russ,

I haven't tested this against a multiuser database, but you could try
setting the following property:
   CurrentProject.Connection.Properties("Jet OLEDB:Connection Control")

Setting it to 1 prevents more than 1 user from connecting to the database.
Setting it to 2, alows multiple users to connect.

Use something like the following, called from the AutoExec macro:

Public Function VerifyLicense()
   If IsMultiUser Then
       CurrentProject.Connection.Properties("Jet OLEDB:Connection Control")
= 2
   Else
       CurrentProject.Connection.Properties("Jet OLEDB:Connection Control")
= 1
   End If
End Sub

Like I said, I've never tried this on a multiuser database. If it works,
great, if not, no harm done (provided you set the property back to 2).

Failing that, you can use the following (which is adapted from code written
(I think) by Dev Ashish).

Private Const JET_SCHEMA_USERROSTER =
"{947bb102-5d43-11d1-bdbf-00c0­4fb92675}"

Public Function LimitUsers(iNumber As Integer) As Boolean
   'Compare the number of database users to a provided number,
   'and if greater, shutdown the current database instance.

   Dim rs As ADODB.Recordset
   Dim iCtr As Integer

   'Make sure the programmer allows at least one user.
   If iNumber = 1 Then iNumber = 2

   'Open the roster.
   Set rs = CurrentProject.Connection.Open­Schema( _
           adSchemaProviderSpecific, , JET_SCHEMA_USERROSTER)

   'rs.RecordCount doesn't work reliably here, so we need to cycle
   'through the recordset to count the number of users.
   Do While Not rs.EOF
       iCtr = iCtr + 1
       'If the number of users exceeds iNumber, then shutdown the
       'current database instance.
       If iCtr > iNumber Then GoTo Proc_Shutdown
       rs.MoveNext
   Loop

   'Clean up
   rs.Close
   Set rs = Nothing
   Exit Function

Proc_Shutdown:
   'Clean up before shutting down the current database instance.
   rs.Close
   Set rs = Nothing
   Application.Quit
End Function

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
---------------------------

> Hello,
>
[quoted text clipped - 15 lines]
>
> Thanks...
Russ Scribner - 09 Mar 2006 19:45 GMT
Thanks for the good ideas Graham.  I think I've got it solved with the
WhosOn() function - but your ideas would probably have been simpler...

Thanks again...
Signature

Russ Scribner

> Russ,
>
[quoted text clipped - 87 lines]
> >
> > Thanks...
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.