CheckCurrentUsers_v? (1 Viewer)

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
This relates to isladogs CheckCurrentUsers_v?


I have found using the below code with the connection sting below it works just fine
C:\Database Dreams\Project Manager\Project Manager Data.accdb

But with this one it fails
C:\Database Dreams\Project Manager\Clients A-Z Folders\D\Database Dreams\Project - Works Manager - P-41-52\Design Version\Works Data.accdb



Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()
On Error GoTo Err_Handler
Dim C As Long

     cn.Provider = CurrentProject.Connection.Provider
    
    'Get data source
     cn.Open "Data Source=" & Replace(CurrentDb.TableDefs("TableName").Connect, ";DATABASE=", "")
     
    'The user roster is exposed as a provider-specific schema rowset
    '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
    Set rs = cn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
        While Not rs.EOF
           C = C + 1
        rs.MoveNext
        Wend
    Me![txtNo] = C
Exit_Handler:
    Exit Sub

Err_Handler:
    
    'errors with network files to be ignored
    If Err = 3705 Or Err = 3704 Or Err = -2147467259 Or Err = 94 Then Resume Next
    
    'If Err <> 3265 Then
        MsgBox "Error " & Err.Number & " in " & " procedure : " & vbNewLine & _
            Err.Description, vbExclamation, "Program error"
    'End If
 Resume Exit_Handler

End Sub
my test form I had my developer verson as user version connected to that data file

 

Attachments

  • 2019-09-22 (2).png
    2019-09-22 (2).png
    9.8 KB · Views: 422
  • 2019-09-22 (3).png
    2019-09-22 (3).png
    3.8 KB · Views: 398
Last edited:

June7

AWF VIP
Local time
Today, 11:46
Joined
Mar 9, 2014
Messages
5,423
You have subfolders D and Database Dreams?

Really looks like two path strings smushed together.
 

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
You have subfolders D and Database Dreams?

Really looks like two path strings smushed together.


No It's for inhouse programs while other folders are client realated It make it easy to backup keeping all together.


thanks mick
 

June7

AWF VIP
Local time
Today, 11:46
Joined
Mar 9, 2014
Messages
5,423
Sorry, I don't understand how that can be a valid path reference.
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:46
Joined
Sep 21, 2011
Messages
14,046
I don't see anything wrong with the path, other than that it has a huge heirarchy? :confused:
 

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
Sorry, I don't understand how that can be a valid path reference.

No problem my system work by adding a folder when a new client is added then creates a folder when a project is created for that client all files are kept in the main clients folder

I'm going to try reducing the connection string to see where if fails but would not expect a connection string that long for a standard system or network
 

isladogs

MVP / VIP
Local time
Today, 19:46
Joined
Jan 14, 2017
Messages
18,186
Agree with June - its a very peculiar path which appears to be a mixture of drive letter and UNC
The generic description for error 3251 is Operation is not supported for this type of object
You haven't said which line triggers the error but it may be that a path of that length /complexity is too long for the old LDB roster cde to handle

Try copying the files to a shorter path and see if it now works
Also have a look at the other David Crake utility I updated which is in my opinion a more useful application anyway: Password login with session login recording
 

June7

AWF VIP
Local time
Today, 11:46
Joined
Mar 9, 2014
Messages
5,423
Sure, it's a valid path if there really are subfolders named "D" and "Database Dreams".

But "D" looks like a mapped drive letter.
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:46
Joined
Sep 21, 2011
Messages
14,046

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
It's only for internal use makes finding things easy been using it for 20 years nearlly or since windows 98 at least.
my system puts a company starting with say J into folder J for jolly crumets ltd.
never had a problem when linking front and backends but was thinking it was to long so will move the current db underdesign


Moved it to:
C:\Database Dreams\Project Manager\Clients A-Z Folders\Underdesign\Works Manager Design Version\Works Data.accdb
And works fine thanks all mick
 
Last edited:

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
Just remembered why I designed the folder structure like that it was originally stored on a network but had to move it when server died but will move the A-Z folders to c drive as an looking at getting another server.

On a different note I am getting a count of 2 using the code I posted above I'm new to this sort of thing is that correct.

Many thanks and very nice job isladogs I'll be using it from now on
 

isladogs

MVP / VIP
Local time
Today, 19:46
Joined
Jan 14, 2017
Messages
18,186
For the benefit of other members this thread refers to the example app available at https://www.access-programmers.co.uk/forums/showthread.php?t=295174

@Mick
If you are using the utility to check users in an external app, you will always see an extra record for that utility marked CurrentDB=Yes. That was how the original app by David Crake was set up.
If you think that is confusing, you can filter the list to exclude that record or just use the code within the application that you are checking.

Hope that helps
 

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
Thanks I'll just set c=-1 which will give me a correct count of users accessing the data file thanks for your help
Mick

Ps its checking a linked data file from front end
 

isladogs

MVP / VIP
Local time
Today, 19:46
Joined
Jan 14, 2017
Messages
18,186
Why check a linked datafile from the front end?
The users will just be those using the frontend so you just need to check the current frontend app.
 

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
I wanted to check how many were using it I.e. how many front ends were linked to it is there another way of limiting the number of front ends linked to a data file

Thank mick
 

isladogs

MVP / VIP
Local time
Today, 19:46
Joined
Jan 14, 2017
Messages
18,186
As I said, the list of front end users gives you exactly that information.
If the tables are linked, the front end is automatically connected to the BE whether or not the end user is actually making any direct or indirect use of the tables.

This code can't be used to limit the number of users. It can be used to lock an external application but that's a 'global setting'.

I do have code to limit the number of concurrent users as part of one of my commercial apps. However the code is something I need to keep private as its linked to the number of licenses purchased
 

Dreamweaver

Well-known member
Local time
Today, 19:46
Joined
Nov 28, 2005
Messages
2,466
Thanks for the help looks like I'll have to change my plans

Thanks mick
 

Users who are viewing this thread

Top Bottom