![]() Mark contributions as unhelpful if you find them irrelevant or not valuable to the article. Note that in the Immediate window returns a list of users in the database. Type the following in the Immediate window and press ENTER: ShowUserRosterMultipleUsers Press CTRL+G to open the Immediate Window in the Visual Basic Editor.ĩ. Close the Northwind database and when prompted, save changes to ShutDownDB (This must be done to release an exclusive lock on the database due to the code you have just added).Ĩ. 'Output the list of all users in the current database.ĭebug.Print rs.Fields( 0).Name, "", rs.Fields( 1).Name, _ Set rs = cn.OpenSchema(adSchemaProviderSpecific, _ ' listed in ADO 's type library for schema rowsets ' reference the schema, as provider-specific schemas are not ' The user roster is exposed as a provider-specific schema rowset & "Data Source=c:\Northwind.mdb" 'example of db path Type the following code in the new ShowUsers module:Ĭn.Open "Data Source=c:\Northwind.mdb" 'example of db pathĬn2.Open "Provider=.4.0 " _.In the Database Window, click Modules under Objects, and then click New.In Microsoft Access, open C:\Northwind. ![]() Copy the Northwind sample database the C:\ folder.For this code to run properly, you must reference the Microsoft ActiveX Data Objects 2.x Library (where 2.x is 2.1 or later.) To do so, click References on the Tools menu in the Visual Basic Editor, and make sure that the Microsoft ActiveX Data Objects 2.x Library check box is selected. (the Northwind db is just a sample) NOTE: The sample code in this article uses Microsoft ActiveX Data Objects. To demonstrate the code example, follow these steps: The user list capability is also useful in isolating problems with database corruption that is associated with the activities of a specific user. The user list capability can be used in conjunction with the connection control capability to determine which users are still connected, so that they can be asked to disconnect.Whether or not the user connection was terminated normally.(A user's ID remains in the lock database until the last user disconnects or until the slot is reclaimed for a new user connection.) Whether or not the user is currently connected to the database.Name of the computer that the user is using.The list can be obtained via the ADO programming interface and returns the following information for each user: Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The user list feature provides a way of determining who is currently connected to a Microsoft Jet database. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. The code example in this article show you how to do this. mdb database, you can output a list of users who are logged into a database. By using Microsoft Visual Basic for Applications in Microsoft Access.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |