Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error with external database

Status
Not open for further replies.

Tazcat

Technical User
Feb 17, 2003
40
0
0
US
Hi,
I have a function from a command button, that opens another database from within my current db, runs a module there, and then closes it. The function itself works fine. Here's the problem: if the active user already has an instance of the reference db open, the function throws an error, and fails. Here is the code:

Code:
Dim appAccess As New Access.Application
Dim strDBLoc As String

    strDBLoc = fncFindCashMgmt
    strDBLoc = strDBLoc & "Cash_mgmt.mdb"
    
    SendKeys "%O", False
    appAccess.OpenCurrentDatabase strDBLoc
    SendKeys "{ENTER}", False
    appAccess.Run "Cash_mgmt.importActivityfromLMS"
    appAccess.CloseCurrentDatabase
    
    MsgBox "Import Pool Activity completed."

What I'm hoping to find some help with, is a way to test if the active user has a instance of the reference db ("Cash_mgmt.mbd") already open. Even better if someone can help me find a way to close the instance before executing my code.

Thanks!
Melanie
 
Some threads /FAQs.
Can I find who's in a database by the .LDB file
thread705-1122629
Automatically logging out idle users
faq181-1432
Activity Monitor - Have you ever needed to view what form(s)/report(s) a user currently has open?
faq181-5070
Auto Close Idle Access Database?
thread181-867447


 
Thanks Remou,
those are all great threads. Unfortunately, they don't cover what I need. I need something that

a) rather than working on a timer, works on command and

b) checks to see if the active user currently has the other db open on the same system.

It doesn't throw an error if someone else has the outside db open, only if the person running the command does. Any thoughts about how I check the current PC for additional instances of Access?

Melanie
 
That was it!!! It even had the code to close the window if found. Thank you so much, Remou!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top