linked form in access between 2 databases

G

Guest

I would like to link 2 Front end databases.

I.e. link the forms like the linked tables.

is this possible?
 
N

Nikos Yannacopoulos

Richard,

It is possible to import a form from another database, and it will work as
long as the table(s) / query comprising its recordsource exist. You cannot
link a form though like you can link a table.

HTH,
Nikos
 
M

Michel Walsh

Hi,



Somehow, yes.


Say the form is under database db22.mdb, assume it is Form1, and that Form1
HAS CODE behind it ( it won't work with a "light form").

In a module of db22, have:
==================
Option Compare Database
Option Explicit

Public Function Form1Factory() As Form_Form1

Dim x As Form_Form1
Set x = New Form_Form1
x.Visible = True

Set Form1Factory = x

End Function
==================


Now, open db20.mdb. Add db22.mdb in the "References" for the project ( Use
the Browse button, change the file type for *.mdb, locate and select
db22.mdb)..

You can then, in db20, use Form1 of db22 like this:

=====================
Option Compare Database
Option Explicit

Public Sub Testing()
Dim y As Object
Set y = db22.Form1Factory()

MsgBox "Hi"
End Sub
====================

Note that if y goes out of scope, at the end of the function, the form
closes, so, we need the MsgBox to "stop" the execution of the program.




Hoping it may help,
Vanderghast, Access MVP
 

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