Open a form in another DB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

good Day all,

I am trying to open a form in another DB, how can I do this? would I need
to link the tables that the other form is based on?

Thanks,

Brook
 
Brook said:
good Day all,

I am trying to open a form in another DB, how can I do this? would I need
to link the tables that the other form is based on?

Write a public sub in a standard module of the database with the form that
you want to open. Something like:

Public Sub OpenMyForm()
DoCmd.OpenForm "frmMyForm"
End Sub

Set a reference to that database in the 2nd database.

Call that sub-routine from the 2nd database:

OpenMyForm

That's it!
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks for the response, but i'm a little confused...

I understand the fist part... but don't know how to set the reference to the
second DB from the first DB....

BRook
 
Brook said:
Thanks for the response, but i'm a little confused...

I understand the fist part... but don't know how to set the reference
to the second DB from the first DB....

Open the VBA development window and then go to Tools - References. You will see
a list of all of the COM libraries registered on your PC and the ones that your
file is actually using will be at the top and "checked". By default there will
be three or four that are always checked.

On that dialog listing the references is a button that allows you to add new
ones that are not in the list by "browsing" to the file. Using that method you
can create a reference to another Access file. Once done any public methods
that exist in the referenced file can now be used in the referencing file.
 
Rick Brandt said:
Open the VBA development window and then go to Tools - References. You will see
a list of all of the COM libraries registered on your PC and the ones that your
file is actually using will be at the top and "checked". By default there will
be three or four that are always checked.

On that dialog listing the references is a button that allows you to add new
ones that are not in the list by "browsing" to the file. Using that method you
can create a reference to another Access file. Once done any public methods
that exist in the referenced file can now be used in the referencing file.

To add to Rick's poar:

Clicking the Browse button opens a dialog to add a new reference (or find an
existing one). Change the Files of Type dropdown box to MDB, then browse to
the file which contains the public sub or function. You can also use this
method to create add-ins or code libraries.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top