Forms from two different .mbd files

G

Guest

Dear Sirs

I have two databases (say DB1 and DB2 - so, two .mbd files)
I have two Forms (one in DB1 and one in DB2)
I am opening the Form from DB1 with a command button in a Form in DB2.
The code I have is working:

In DB1 I have a Module like this:

Public Sub OpenStatements()
DoCmd.OpenForm "statements"
End Sub

In DB I have the following VB in my command button to open the form:

Private Sub OpenstatementsForm_Click()
Openstatements
End Sub

- but - I would like that the Form from DB1 is opening In DB2 like a
subform with a button click.

If I would like to open with a command button a Form as a subform I use the
following code (but that is if the Form and the subform is in the same
Database):

Private Sub Command32_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "anyform
Me.[dummyform2].SourceObject = "anyform"
End Sub

Somehow, I think, I have to combine those two codes for opening a form as a
subform in another DB Form.
Can someone help me?

Thanks for your help
Klaus
 
W

Wolfgang Kais

Hello "Amateur".

Amateur said:
Dear Sirs

I have two databases (say DB1 and DB2 - so, two .mbd files)
I have two Forms (one in DB1 and one in DB2)
I am opening the Form from DB1 with a command button in a Form in
DB2. The code I have is working:

In DB1 I have a Module like this:

Public Sub OpenStatements()
DoCmd.OpenForm "statements"
End Sub

In DB I have the following VB in my command button to open the form:

Private Sub OpenstatementsForm_Click()
Openstatements
End Sub

- but - I would like that the Form from DB1 is opening In DB2 like a
subform with a button click.

If I would like to open with a command button a Form as a subform I
use the following code (but that is if the Form and the subform is
in the same Database):

Private Sub Command32_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "anyform
Me.[dummyform2].SourceObject = "anyform"
End Sub

Somehow, I think, I have to combine those two codes for opening a
form as a subform in another DB Form.
Can someone help me?

I think this is impossible.
You should link the tables and import the queries/form from Db1 to
DB2. Then you can use code above.
 

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