The database, and every object in the database,
has an owner. By default, the owner is the user that created that object. The
object owner has special priveleges for that object in that he or she can
always assign or revoke permissions for that object.
The following listings demonstrate how to get
the user name of the object owner.
DAO
Sub DAOGetObjectOwner()
Dim db As DAO.Database
Dim wks As DAO.Workspace
' Open the database
DBEngine.SystemDB = _
"C:\Program Files\Microsoft Office\Office\SYSTEM.MDW"
Set wks = DBEngine.CreateWorkspace("", "Admin", "password")
Set db = wks.OpenDatabase(".\NorthWind.mdb")
' Print the owner of the Customers table
Debug.Print db.Containers("Tables").Documents("Customers").Owner
End Sub
ADOX
Sub ADOGetObjectOwner()
Dim cat As New ADOX.Catalog
' Open the catalog
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=.\NorthWind.mdb;User Id=Admin;" & _
"Password=password;Jet OLEDB:System database=" & _
"C:\Program Files\Microsoft Office\Office\SYSTEM.MDW"
' Print the owner of the Customers table
Debug.Print cat.GetObjectOwner("Customers", adPermObjTable)
End Sub
With DAO, you use the Owner
property of a Document or Container
object to retrieve the user name of the object owner. With ADOX, you use the GetObjectOwner method of a Catalog
object. This method takes the object's name and type as parameters.
Replication
Replication enables users at different locations
to easily share the changes they are making to a database. Copies of a
database, called replicas, can be made and distributed to users at different
locations. Users at each location can work on their local copy and then share,
or synchronize, their changes with users at other locations.
Note Use JRO, not ADO, to
implement replication in your application.
EmoticonEmoticon