Set focus on newly opened MDB/MDE

C

Chibby

Hello,

Does anyone know how to give an MDB/MDE the focus when opened with the
OpenCurrentDatabase() method. My code basically looks like this:
Set KVapp = CreateObject("Access.Application")
KVapp.OpenCurrentDatabase nameofDB2
This code successfully opens the desired MDB/MDE file, however the new
window is behind the calling database window. I'd like the newly opened
database to have the focus instead. I've tried using KVapp.visible=true and
KVapp.Forms("someform").setfocus with no avail.

It might be important to describe the overall setup:
I have 4 MDB/MDE files. One holds the tables only (TBLS). Another holds
only modules and a few forms for common/shared functions (UTILS). The
remaining 2 files are "normal" MDB/MDE files (DB1 and DB2). DB1 and DB2 both
link to the tables in TBLS and both Reference the UTILS file. I use a
control on a form in DB1 to call a sub in UTILS that opens DB2. It's the
code snipit above. Does the calling database, DB1, maintain the focus
because the last sub to complete execution belongs to DB1?

Thanks for any help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top