smegghead
asked on
Multiple workgroups Jet DAO
Hi,
I've got two JET databases, each database has its own workgroup file. How can I open both databases within the same application ??
According to the help text, as soon as you use DAO, the systemDB property of the DBEngine object becomes read only.
Is there a way around this ??
I've got two JET databases, each database has its own workgroup file. How can I open both databases within the same application ??
According to the help text, as soon as you use DAO, the systemDB property of the DBEngine object becomes read only.
Is there a way around this ??
WHOOPS - though I was in the access area!
Ok you can do it!
I do it at the moment by maintaining an array containing the data from each recordset, following this process..
set system db1
open database1
copy data from rs to array
close
set to nothing
set system db2
open database2
copy data from rs to array
close
set to nothing
****DO WHATEVER***** (i merge the data here)
set system db1
open database1
save data from array to table
close
set to nothing
set system db2
open database2
save data from array to table
close
set to nothing
Of course this is a kind of one of thing - if you want it for concurrent access I think if you use ADO and talk to access via a DSN, you can create a DSN for each DB specifying the system.mdw. Never tried it though....
Good Luck
Simon
Ok you can do it!
I do it at the moment by maintaining an array containing the data from each recordset, following this process..
set system db1
open database1
copy data from rs to array
close
set to nothing
set system db2
open database2
copy data from rs to array
close
set to nothing
****DO WHATEVER***** (i merge the data here)
set system db1
open database1
save data from array to table
close
set to nothing
set system db2
open database2
save data from array to table
close
set to nothing
Of course this is a kind of one of thing - if you want it for concurrent access I think if you use ADO and talk to access via a DSN, you can create a DSN for each DB specifying the system.mdw. Never tried it though....
Good Luck
Simon
ASKER
That's the way I'm currently doing it.. via odbc, I was just wondering if there was a way using DAO.
I don't suppose there can be as the SystemDB property applies to a non-collective object (DBEngine).
Thanks for your suggestions anyway..
if nobody adds any other comments in the next few days, I'll award the points.
I don't suppose there can be as the SystemDB property applies to a non-collective object (DBEngine).
Thanks for your suggestions anyway..
if nobody adds any other comments in the next few days, I'll award the points.
systemdb has to be set before allocating dbengine. Once it's allocated you can't change it. It seems like you should be able to allocate 2 dbengines though.
Whoops, You can only create 1 dbengine but I wonder if you can create 1 dbengine/DLL. What abaout setting up a different project to handle the other database.
ASKER
leg1, I thought about the 'Other project' approach, but it's a bit messy. However, the suggestion about multiplie instances of DAO... now you might have something there...
can you ..
dim DAO1 as new dao
dim DAO2 as new dao
set dao1.dbengine.systemdb=fil e1
set dao2.dbengine.systemdb=fil e2
Hmmm, I'll have a play with that.
can you ..
dim DAO1 as new dao
dim DAO2 as new dao
set dao1.dbengine.systemdb=fil
set dao2.dbengine.systemdb=fil
Hmmm, I'll have a play with that.
ASKER
Nope, just tried it... Unless I'm doing something wrong...
Option Explicit
Dim x As New DAO.DBEngine
Dim y As New DAO.DBEngine
Private Sub Form_Load()
x.SystemDB = "c:\winnt\system32\rrrr.md w"
MsgBox x.SystemDB
y.SystemDB = "c:\winnt\system32\system. mdw"
MsgBox x.SystemDB
MsgBox y.SystemDB
End Sub
The first messagebox appears as rrrr.mdw, then the next two as system.mdw
Oh well
Option Explicit
Dim x As New DAO.DBEngine
Dim y As New DAO.DBEngine
Private Sub Form_Load()
x.SystemDB = "c:\winnt\system32\rrrr.md
MsgBox x.SystemDB
y.SystemDB = "c:\winnt\system32\system.
MsgBox x.SystemDB
MsgBox y.SystemDB
End Sub
The first messagebox appears as rrrr.mdw, then the next two as system.mdw
Oh well
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Leg and Simon...
I gave up on it.
I gave up on it.
I don't think you cna do this in access - you have to use VB. The closest I could get was to open 2 db's with different users from the same mdw e.g.
Dim ws1 As Workspace
Dim ws2 As Workspace
Dim db1 As Database
Dim db2 As Database
Set ws1 = DBEngine.CreateWorkspace("
Set ws2 = DBEngine.CreateWorkspace("
Set db1 = ws1.OpenDatabase("c:\db1.m
Set db2 = ws2.OpenDatabase("c:\db2.m
I'll be dead keen to know if there is an answer to this one as I am certain JET can only use 1 system db.
Simon