Получить доступ к таблицам другой базы данных с иной рабочей группой. Материал доступен по ссылке
silich 02.05.2001
От: silich 02.05.2001 16:11:25 как подключить таблицы из файла ДРУГОЙ wrkgrp? Привет, All! есть одна wrkgrp и я в ней работаю... хочу податтачить неколько таблиц из файла, созданного в другой wrkgrp... пароль и юзер у меня известен как для первой так и для фторой wrkgrp...
46. How can I open a database in code that was secured using another workgroup file? The unsupported privDBEngine object allows you to connect to another database in code. This does not open the database by starting an instance of Access, so you only have access to Jet objects (tables and queries). You can work with any DAO objects.
Sub OpenDBWithNewWorkgroupFile(strPathToFile As String, _ strDefaultUser As String, _ strDefaultPwd As String, _ strPathToDatabase As String) ' This function uses the unsupported PrivDBEngine object to ' open a database using a different workgroup information file ' than the one being used as the default. You might do this if ' you want to access data that is in a secured database that uses ' a different workgroup information file.
Dim dbe As PrivDBEngine Dim wrk As Workspace Dim dbs As Database
' Return a reference to a new instance of the PrivDBEngine object. Set dbe = New PrivDBEngine ' Set the SystemDB property to specify the workgroup file. dbe.SystemDB = strPathToFile dbe.DefaultUser = strDefaultUser dbe.DefaultPassword = strDefaultPwd Set wrk = dbe.Workspaces(0) ' Open the secured database. Set dbs = wrk.OpenDatabase(strPathToDatabase) End Sub
Note that the PrivDBEngine object is Not doing anything other than creating a new instance of the Jet engine. You can get the same functionality by using code such As the following:
Dim dbe As DAO.DBEngine Set dbe = CreateObject("DAO.DBEngine")
The "DAO.DBEngine" string would be used for Jet 3.0. To use later versions, you would use "DAO.DBEngine.35" or "DAO.DBEngine.36" for Access 97 and Access 2000, respectively. For more information, see the DAO to ADO migration paper, listed in Section 47.