1

I am using a form in Access to open other access databases that perform various different queries that publish reports. As the databases I am opening use a multitude of tables, queries, and reports that have nothing to do with each other it would be awkward and time consuming to link to them all and tedious to make changes inside the original database.

I am using Dim appAccess As Access.Application to open each one. It creates a 2nd instance of the new accdb which will not become visible. However, if I go into view code in the original database and then go back to the form it opens the new instance perfectly visible and will continue to do so as long as I keep the original database open. If I close the original database and reopen it I have the same issue which can only be resolved by viewing the code again. As an example of what I am using

Option Compare Database

Dim APP As Access.Application

Sub TEST()

Set APP = New Access.Application

APP.Visible = True

APP.OpenCurrentDatabase "C:\Users\Documents\Database1.accdb"

End Sub

Does anyone know why this is happening?

1
  • I am not sure if this question was answered Commented Aug 13, 2021 at 16:35

1 Answer 1

0

Add line:

APP.UserControl = True

For more info review https://www.devhut.net/2018/01/21/ms-access-VBA-open-another-database/#:~:text=MS%20Access%20VBA%20%E2%80%93%20Open%20Another%20Database%201,to%20truly%20appreciate%20the%20power%20of%20automation.%20

Sign up to request clarification or add additional context in comments.

6 Comments

adding line app..UserControl = true does not work
Since it did for me, can't explain why not for you.
well thanks for the help anyway. This occurs on two different computers using access 360 on a windows 7 and a windows 10 platform. Its driving me crazy.
That info is not in question even though it does appear relevant to issue. This code works on other computers? Appears you are not the only one encountering issue of code not work on those computer configurations stackoverflow.com/questions/68778422/…
It is not an issue of not working. It does work after I view the code and then close view code. And continues to work every time until I close the accdb. The issue is why viewing the code impacts the success of the procedure.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.