who is using ms access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kowndinya
    New Member
    • Sep 2006
    • 26

    who is using ms access database

    Hello,
    i have developed a small program in VB 6.0 and the backend is MS ACCESS.
    i want to know who is currently logged ms access database. Some body accessing this database by using my program which is located in a local server. some times i need to modify the database. Hence i need to open ms access exclusively for me. But i am unable to open it. it was locked by some other user. if i know that user name, i can ask him to exit the program.
    Can anyone give some ideas how to know the current user of this database.

    Thanks
    Raj
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by kowndinya
    Hello,
    i have developed a small program in VB 6.0 and the backend is MS ACCESS.
    i want to know who is currently logged ms access database. Some body accessing this database by using my program which is located in a local server. some times i need to modify the database. Hence i need to open ms access exclusively for me. But i am unable to open it. it was locked by some other user. if i know that user name, i can ask him to exit the program.
    Can anyone give some ideas how to know the current user of this database.

    Thanks
    Raj

    You want Modify tables or Database Name

    Comment

    • kowndinya
      New Member
      • Sep 2006
      • 26

      #3
      Originally posted by hariharanmca
      You want Modify tables or Database Name
      I want to modify table only.

      thanks
      Raj

      Comment

      • bbasberg
        New Member
        • Oct 2006
        • 24

        #4
        Hi Raj,

        I use this code (modify name of database and path (in 2 places) to suit your environment):
        Code:
        Sub ShowUserRoster()
            Dim cn As New ADODB.Connection
            Dim cn2 As New ADODB.Connection
            Dim rs As New ADODB.Recordset
            Dim i, j As Long
        
            cn.Provider = "Microsoft.Jet.OLEDB.4.0"
            cn.Open "Data Source=c:\yourdatabase_with_path.mdb"
        
            cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
            & "Data Source=c:\yourdatabase_with_path.mdb"
        
            ' The user roster is exposed as a provider-specific schema rowset
            ' in the Jet 4 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
        
            Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
            , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
        
            'Output the list of all users in the current database.
        
            Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
            "", rs.Fields(2).Name, rs.Fields(3).Name
        
            While Not rs.EOF
                Debug.Print rs.Fields(0), rs.Fields(1), _
                rs.Fields(2), rs.Fields(3)
                rs.MoveNext
            Wend
        
        End Sub

        Comment

        • hariharanmca
          Top Contributor
          • Dec 2006
          • 1977

          #5
          Originally posted by kowndinya
          I want to modify table only.

          thanks
          Raj

          See, when the table in the database is used by other user or sometimes your application may use that table in that time you can’t change the design structure of that table, check that your application Run Mode was stop properly and then try to change the table design.

          Comment

          • hariharanmca
            Top Contributor
            • Dec 2006
            • 1977

            #6
            Originally posted by bbasberg
            Hi Raj,

            I use this code (modify name of database and path (in 2 places) to suit your environment):
            Code:
            Sub ShowUserRoster()
                Dim cn As New ADODB.Connection
                Dim cn2 As New ADODB.Connection
                Dim rs As New ADODB.Recordset
                Dim i, j As Long
            
                cn.Provider = "Microsoft.Jet.OLEDB.4.0"
                cn.Open "Data Source=c:\yourdatabase_with_path.mdb"
            
                cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
                & "Data Source=c:\yourdatabase_with_path.mdb"
            
                ' The user roster is exposed as a provider-specific schema rowset
                ' in the Jet 4 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
            
                Set rs = cn.OpenSchema(adSchemaProviderSpecific, _
                , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
            
                'Output the list of all users in the current database.
            
                Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
                "", rs.Fields(2).Name, rs.Fields(3).Name
            
                While Not rs.EOF
                    Debug.Print rs.Fields(0), rs.Fields(1), _
                    rs.Fields(2), rs.Fields(3)
                    rs.MoveNext
                Wend
            
            End Sub
            yes, i work on that its fine

            Comment

            • kowndinya
              New Member
              • Sep 2006
              • 26

              #7
              Originally posted by hariharanmca
              yes, i work on that its fine
              it is working fine.
              thank you all.
              Raj

              Comment

              • adnan amin
                New Member
                • Jan 2007
                • 8

                #8
                Originally posted by kowndinya
                Hello,
                i have developed a small program in VB 6.0 and the backend is MS ACCESS.
                i want to know who is currently logged ms access database. Some body accessing this database by using my program which is located in a local server. some times i need to modify the database. Hence i need to open ms access exclusively for me. But i am unable to open it. it was locked by some other user. if i know that user name, i can ask him to exit the program.
                Can anyone give some ideas how to know the current user of this database.

                Thanks
                Raj
                ya im using MS access with VB6.0
                if need any kind of help ask me..okkkkkkkkkk kk

                Comment

                Working...