Open form in another database (1 Viewer)

kitty77

Registered User.
Local time
Today, 17:49
Joined
May 27, 2019
Messages
712
How can I open a form from another database? I have a form with a command button. I would like to be able to open another form, in another database?

Possible?
 

kitty77

Registered User.
Local time
Today, 17:49
Joined
May 27, 2019
Messages
712
I tried the following... but nothing happened. I did see a lock file that it was open but no form came up?

Dim objAdb As Object

Set objAdb = CreateObject("Access.Application")
objAdb.OpenCurrentDatabase ("C:\Users\accessdatabase.accdb")
objAdb.DoCmd.OpenForm "Form"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:49
Joined
Oct 29, 2018
Messages
21,469
Try adding objAdb.Visible=True

Sent from phone...
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:49
Joined
Feb 19, 2002
Messages
43,266
you might have better success if you create a macro in the other database that opens the form you want. Then in the OpenCurrentDatabase, pass the macro switch followed by the name of the macro.

Keep in mind that you probably won't be able to circumvent the other apps normal procedures. If it expects a login, you'll need to login. If it uses a switchboard to control operations, you'll need to open the switchboard.

What is the point of automating the form in a different app? You might be able to simply link to the BE and use a query to retrieve data if that is what you are trying to do. Forms are for human interaction. I don't recommend automating them via code. We may be able to offer a more specific solution once we know your actual objective.
 

JRMT

New member
Local time
Tomorrow, 00:49
Joined
Dec 3, 2020
Messages
23
Hi Sir this is also what i wanted to happen, here is the scenario i have 2 database ex. database1 and database2 both have login form. when you open database 1 you need to login, after logged in it has a button database2. when i clicked database 2 button it has a batch file that will actually open database2 and then you need to login again. heres my question is it possible that when i login in database1 when i open database2 i dont need to login anymore but the user that used to login in database1 will also reflect in database2.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:49
Joined
Feb 19, 2002
Messages
43,266
Not if you go through the normal procedure to open the app. And as I said, you probably can't circumvent the login easily if the app is built to have the login form open and hidden as all of mine are.

You can probably modify the other application to take a parameter you pass as the database is opened. You will have to modify the other app's opening form or AutoExec to do this.
 

Users who are viewing this thread

Top Bottom