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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening 2nd database and Word doc problems 1

Status
Not open for further replies.

swpsoak

Technical User
Mar 5, 2002
15
US
Opening 2nd database and Word doc problems

FIRST: Thanks to all who help on this web site. All of you have been a great help. I really appreciate it.

Have: Access 97
Database 1
Database 2

******Problem 1******
DB1, when open and maximized has a Cmd button that opens DB2 by way of a hyperlink address.

Results: No problem. DB2 opens – maximized, and DB1 is minimized to the Toolbar.

Problem: DB2 has a Cmd button used to exit (close) DB2, and it work fine, but DB1 stays minimized down on the toolbar.

Question: I have tried all I know…I think:>)
To the DB2 close button code, is there code to maximize DB1 when DB2 closes?

******Problem 2******
In the above Database 2:
In DB2 I have a hyperlink that opens a Word Document with toolbars turned off that works great except; the Word document is not maximized. The document is not minimized, but the whole application is about 80%.
I can maximize it manually, but I would like it to maximize when it opens.
Any suggestions, threads, ...?

THIS IS THE CODE TO OPEN THE WORD DOCUMENT.

Code:
    Dim WordDoc As Object
    Dim strDocument As String
    strDocument = "C:\LubeDb\Instructions.doc"
    Set WordDoc = CreateObject("Word.Application")
    WordDoc.Documents.Open strDocument
       
[COLOR=green]' Turn all the toolbar off.[/color]
    
    WordDoc.CommandBars("Standard").Visible = False
    WordDoc.CommandBars("Formatting").Visible = False
    WordDoc.CommandBars("Web").Visible = False
    WordDoc.CommandBars("Picture").Visible = False
    WordDoc.CommandBars("Control Toolbox").Visible = False
    WordDoc.ActiveWindow.ActivePane.DisplayRulers = False


Oak
 
Some starting points.
Problem 1:
AppActivate "Microsoft Access"
Problem 2:
WordDoc.WindowState = 1 'wdWindowStateMaximize
WordDoc.ActiveDocument.ActiveWindow.WindowState = 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PH,
Problem solved on Problem 2.
Have a star for the help.

Unfortunately on Problem 1 I have tried AppActivate and all it does is start a new session of Access.
I need DB1 to re-maximize while DB2 is closing.

Just in case, here is the sequence of events:
DB1 is opened and used.
From a button on DB1, DB2 is opened which causes DB1 to minimize.
DB2 is used and when done, a button “DoCmd.Quit” closes DB2.
DB1 stays minimized.

Just in case anyone wonders why I do this.
DB1 information has nothing to do with DB2 information.
DB1 I guess you could say is the master database. And opening DB2 from DB1 is a matter of convenience.
I'm just looking for a clean look and feel for DB1 to re-maximize.
If I can’t, than the user will just have to reach down and click to maximize DB1.

Code:
[COLOR=green]Code for DB2 closing and tried to maximize DB1[/color]
Dim MyAppID
AppActivate "Microsoft Word"
MyAppID = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE", 1)
AppActivate MyAppID
DoCmd.Quit


Oak
 
GOT IT!!

In case anyone wonders how I solved my problem…

FIX:
To the button that closes DB2 On Click… ”DoCmd.Quit”,
I just added a Hyperlink Address… ..\database\DB1.mdb back to DB1.
DB2 closes and DB1 maximizes.

I don't know why DB1 minimizes to begin with and this may not be the “correct” way but this work-around works for me.


Oak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top