Dan Waters
dwaters at usinternet.com
Sun Jan 6 16:00:38 CST 2008
Unless Rocky's db is converted to A2007 from A2003, I don't think it will use a .mdw file for User Level Security. Without a .mdw file, the procedure I sent won't work. It's for A2000 through A2003. Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Robert Sent: Sunday, January 06, 2008 3:05 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Number of Users -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Are you anticipating this application migrating to Access 2007 Format? If so, I'm not sure the GUID and ldb methods will correctly.??? WBR ~Robert Rocky Smolin at Beach Access Software wrote: > That was my first thought as well. Maybe someone will chime in with a bit > of ldb lore. > > Rocky > > > > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller > Sent: Sunday, January 06, 2008 12:17 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Number of Users > > I've never done this before, but can't you interrogate the LDB file to find > out how many users are on at once? > > Arthur > > On 1/6/08, Rocky Smolin at Beach Access Software <rockysmolin at bchacc.com> > wrote: >> Dan: >> >> I always declare dao variables explicitly. But it looks like, as you >> say, a good template. >> >> Thanks >> >> Rocky >> >> >> >> >> >> >> >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters >> Sent: Sunday, January 06, 2008 11:40 AM >> To: 'Access Developers discussion and problem solving' >> Subject: Re: [AccessD] Number of Users >> >> No - you'll need to work on it. >> >> You'll need to use your own tables of course. You'll also need to >> deal with a couple of custom Functions (like 'SystemTitle'), which >> you'll need to either change or remove. >> >> I forgot about this but I believe that you'll need to qualify all your >> other recordset variables with your database as DAO.Recordset or >> ADODB.Recordset . >> If you also set a reference to ADO, then your recordsets will need to >> know which type to become. >> >> This is intended as a template to start with. I hope it does help! >> Dan >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky >> Smolin at Beach Access Software >> Sent: Sunday, January 06, 2008 1:18 PM >> To: 'Access Developers discussion and problem solving' >> Subject: Re: [AccessD] Number of Users >> >> Dan: >> >> Just drop it in and it works? I try to avoid code when I don't >> understand everything it's doing. Can't maintain it. Pretty much set >> a reference to ADO and then plug and play? >> >> Rocky >> >> >> >> >> >> >> >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters >> Sent: Sunday, January 06, 2008 10:45 AM >> To: 'Access Developers discussion and problem solving' >> Subject: Re: [AccessD] Number of Users >> >> Hi Rocky, >> >> This came from MS KB198755, and I've used it for a few years now with >> no problems. This will also tell the person being kicked off who else >> is logged in so they know who to ask to log off. >> >> ------------------------------------------------------------------- >> >> Public Sub UserLimit() >> >> Dim con As New ADODB.Connection >> Dim rst As New ADODB.Recordset >> Dim stgData As String >> Dim stg As String >> Dim stgFullName As String >> Dim rstFullname As DAO.Recordset >> Dim stgUserName As String >> Dim stgNameList As String >> Dim intUsers As Integer >> Dim stgUsers As String >> Dim rstUsers As DAO.Recordset >> Dim stgLockout As String >> Dim rstLockout As DAO.Recordset >> >> '-- The user roster is exposed as a provider-specific schema rowset _ >> in the Jet 4.0 OLE DB provider. You have to use a GUID to _ >> reference the schema, as provider-specific schemas are not _ >> listed in ADO's type library for schema rowsets >> >> '-- This is from MSKB 198755 and is specific to Access 2000 & up >> con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & >> DBEngine.SystemDB >> >> Set rst = con.OpenSchema(adSchemaProviderSpecific, , >> "{947bb102-5d43-11d1-bdbf-00c04fb92675}") >> >> Do While rst.EOF = False >> stgUserName = Left$(rst(1), InStr(1, rst(1), Chr(0)) - 1) >> Set rstFullname = DBEngine(0)(0).OpenRecordset("SELECT Person >> FROM tblPeopleMain" _ >> & " WHERE UserName = '" & stgUserName & "'", dbOpenSnapshot) >> If stgUserName <> "Admin" Then >> If stgNameList = "" Then >> stgNameList = rstFullname("Person") >> Else >> stgNameList = rstFullname("Person") & ", " & vbNewLine >> & stgNameList >> End If >> intUsers = intUsers + 1 >> End If >> rst.MoveNext >> rstFullname.Close >> Set rstFullname = Nothing >> Loop >> rst.Close >> Set rst = Nothing >> >> '-- Look for too many users logging in >> stgUsers = "SELECT ThisMonthUsers FROM tblUserLicenseInformation" >> Set rstUsers = DBEngine(0)(0).OpenRecordset(stgUsers, dbOpenSnapshot) >> If intUsers > rstUsers("ThisMonthUsers") Then >> stgLockout = "SELECT * FROM tblUserLicenseLockouts" >> Set rstLockout = DBEngine(0)(0).OpenRecordset(stgLockout, >> dbOpenDynaset) >> rstLockout.AddNew >> rstLockout("Name") = CurrentPerson >> rstLockout("LockoutDate") = CurrentDate >> rstLockout("LockoutTime") = Format(Now(), "Medium Time") >> rstLockout("AllowedUsers") = rstUsers("ThisMonthUsers") >> rstLockout.Update >> rstLockout.Close >> Set rstLockout = Nothing >> FormattedMsgBox GstgNotReady, "There are insufficient User >> Licenses for you to log on." _ >> & " The following people are now logged on to " & >> SystemTitle & ":" _ >> & vbNewLine & vbNewLine _ >> & stgNameList & "@ @", vbExclamation + vbOKOnly, >> "Insufficient User Licenses" >> rstUsers.Close >> Set rstUsers = Nothing >> DoEvents >> DoCmd.Quit >> Exit Sub >> End If >> rstUsers.Close >> Set rstUsers = Nothing >> >> End Sub >> >> >> ---------------------------------------------------------------------- >> ----- >> >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky >> Smolin at Beach Access Software >> Sent: Sunday, January 06, 2008 10:19 AM >> To: 'Access Developers discussion and problem solving' >> Subject: [AccessD] Number of Users >> >> Dear List: >> >> What is the easiest way to restrict the number of users in a FE/BE >> application? >> >> MTIA >> >> Rocky >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.5.516 / Virus Database: 269.17.13/1210 - Release Date: >> 1/5/2008 >> 11:46 AM >> >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.5.516 / Virus Database: 269.17.13/1210 - Release Date: >> 1/5/2008 >> 11:46 AM >> >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.13/1210 - Release Date: 1/5/2008 > 11:46 AM > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHgUKY72dSYCwH8FQRAnzPAJ0QhmZqAX1nYv/VysO23LIH6gjvcQCdH3t3 VjjgzMETvrWHzdOG58ggMA8= =sKG2 -----END PGP SIGNATURE----- -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com