Solved

How do I maximize an external database window using VBA code in another Access Database?

Posted on 2010-08-19
6
867 Views
Last Modified: 2013-11-27
Hi experts,

I asked a question yesterday relating to opening an external MS Access database from inside another MS Access database.  The code works in the fact that it opens up the external database, but it is not maximizing the external database window.  Instead, it is opening up the MS Access database window a third of the size if it were maximized.

The attach the code that has been used, and includes a Maximize line of code, which I thought was working, but is not.

Any help would be appreciated.

Regards
Terry
'Code below opens the external database

Set acObj = CreateObject("Access.application")

    acObj.OpenCurrentDatabase CurrentProject.Path & "\DatabaseB.mdb"

    acObj.Visible = True

    acObj.UserControl = True

    acObj.DoCmd.Maximize

Open in new window

0
Comment
Question by:TerenceHewett
6 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
Maximize just maximizes the current object, not the entire window. You can try this:

accObj.DoCmd.RunCommand acCmdAppMaximize


0
 
LVL 9

Expert Comment

by:borki
Comment Utility
Alternativly, you could use the shell command as in:

Shell "C:\Program Files (x86)\Microsoft Office\Office12\MSACCESS.EXE CurrentProject.Path & "\DatabaseB.mdb", vbMaximizedFocus

HTH

Felix
0
 
LVL 84
Comment Utility
But Shell doesn't give you the accObj object, which is needed to continue working with the application.
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 9

Expert Comment

by:borki
Comment Utility
Hmm, good point, that might be a requirement...
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
(NO POINTS PLS)
sorry about that Terence, was in a bit hurry yesterday..
LSM post should do it.., just take Note that he is using accObj whereas your code is using acObj
0
 

Author Comment

by:TerenceHewett
Comment Utility
Thanks for all posts. It looks as though the code LSM gave works a treat.  Thank you very much. No problems Cap. I am just really grateful for any help received.  

Regards to all

Terry
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now