OpenDatabase Method

  • Thread starter Thread starter Crystal
  • Start date Start date
C

Crystal

I've got a module that opens a database (DatabaseB) and
runs a procedure stored in that database. We'll call my
current database "DatabaseA"

From DatabaseA, the user will open DatabaseB and run the
procedure "RunUpdate"

The code I'm using for this is:

Dim appRemoteDB as Access.Application
Set appRemoteDB = New Access.Application
appRemoteDB.OpenCurrentDatabase "DatabaseBPathname"
appRemoteDB.Run "RunUpdate"
appRemoteDB.CloseCurrentDatabase

(thank you to whoever gave me that code last week!)

The problem is, the "RunUpdate" module stored in DatabaseB
uses DAO to write to a table in DatabaseA. The code there
is:

Dim db as DAO.Database
Dim rst as DAO.Recordset

set db = OpenDatabase("DatabaseAPathname", False)
set rst = db.OpenRecordset("TableName",dbOpenDynaset)

Even though I've coded DatabaseA to not be opened
exclusively, it still is because I already have it open in
the Access window. I keep getting the error that I
already have this database opened exclusively on another
machine (my machine).

How do I fix this?

Any help would be greatly appreciated,
Crystal
 
This sounds like it is overly complicated with circular procedures.
It appears that you are running updates in B which need to be reflected in A

Since A is already open, why cant you just link to B, Run you updates in B
from A
and then update A with the same linked table idea?

If you like, At the start of the procedure, link to B, run your processes on
B and A then delete the links at the end of the proc.
the entire Link/drop Link process can be hidden from teh user

HS
 
I knew when I originally built it that it probably wasn't
the most efficient way of doing it. Is it possible to
pass a variable from a procedure in DatabaseA to a
procedure in DatabaseB and back again? All I really need
is a boolean value from DatabaseB, the rest is contained
in A.

Thanks,
Crystal
 
Back
Top