Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using OpenAccessProject function in current ADP project

Status
Not open for further replies.

BKQc

Programmer
Jul 26, 2002
118
CA
My problem is that I want my button's onclick action to open a new Acces Project in the current Access Window.

Actually, the code is working but I think it may creates some memory leaking problems.
Code:
    Call Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE C:\myDB.ADP", vbMaximizedFocus)
    DoCmd.Quit

The real problem with OpenAccessProject is that I actually have a project loaded. In the MS documentation, they say that I must use CloseCurrentDatabase() befor using OpenAccessPorject() but if I do that, the latter won't be run since the project is closed!

Anyone has an idea?
 
Simply use automation rather than shelling the project. This is from memory so make sure it works.

Dim oAcc As Access.Application
Set oAcc = CreateObject("Access.Application")
oAcc.Visible = True

-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
OK, I see but by doing it like this, am I not creating a new instance of MSAccess? What if I want to open it in the current Access window?
 
You definitely ARE creating a new instance of Access using automation. But you want something else. You want a new application to replace the current application opened in the Access window. I had misread your original text. -------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top