Open form from another database

T

Troy

Hi!

Can I open a form in a database from code in another database?

I can open another database with GetObject

Set AccessApp = GetObject("D:\Work Data\access\Employee Frontend.mdb")
AccessApp.Visible = True

but how do I open a object within that database?

Regards
Troy
 
E

Eric Blitzer

If you have a macro that opens the form in the other database you cou try
this that I got from Dennis Schmidt on a previous post

This following sample demonstrates how you can execute an Access macro from
another application or database using OLE automation.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>
*** Resolution *** Dec 9 1999 2:50PM tammyd

1. Create an Access database called C:\TestMacro.mdb
2. Create a macro called macTestMsg with the following action:
MsgBox "Macro in TestMacro database"
3. Create another Access database C:TestMacro2.mdb
4. Create a macro called macTestMsg with the following action:
MsgBox "Macro in TestMacro2 database"
5. In the application you choose, create a reference to the Access 8.0
Object
Library
6. Create the following sub procedure:
Sub RunMacroX()

Dim objACC As New Access.Application


Set objACC = GetObject("D:\TestMacro.mdb") 'open first database
objACC.DoCmd.RunMacro ("macTestMsg") 'run macro
objACC.Quit
Set objACC = GetObject("D:\TestMacro2.mdb") 'open second database
objACC.DoCmd.RunMacro ("macTestMsg") 'run macro
objACC.Quit
Set objACC = Nothing

End Sub

Need quick answers to questions like these? The Microsoft Knowledge Base
provides a wealth of information that you can use to troubleshoot a problem
or answer a question! It's located at
http://support.microsoft.com/support/c.asp?M=F>.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

Good luck

Jim
 

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