Solved

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

Posted on 2010-08-19
6
976 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 33473426
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
ID: 33473465
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
ID: 33473508
But Shell doesn't give you the accObj object, which is needed to continue working with the application.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 9

Expert Comment

by:borki
ID: 33473575
Hmm, good point, that might be a requirement...
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33474138
(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
ID: 33480992
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

730 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