Open successive instances of Access maximized

J

j.t.w

Hi.

Hope someone can help.

I have a master switchboard (menu) that opens up other Access
databases. I'm having a problem opening up the other Access databases
maximized. The forms are all maximized, which is not the problem.

Looking through the NG posts, I've come across this bit of code that
opens another Access instance, maximizes it (supposedly), and opens my
database. Unfortunately, the ".RunCommand acCmdAppMaximize" does not
work. I've even tried changing it to "DoCmd.RunCommand
acCmdAppMaximize", but no luck.

--------------------Start of Code------------------------------
Dim objAccess As Access.Application

Set objAccess = CreateObject("Access.Application")
With objAccess
.Visible = False
.RunCommand acCmdAppMaximize
.OpenCurrentDatabase ("C:\MyTestDatabase\Test1.mdb")
.Visible = True
End With
Set objAccess = Nothing

DoCmd.Quit
--------------------End of Code--------------------------------

I've even found another bit of code that works properly, but when
opening, Access "flickers" between the background and the new form
showing.

Shell "MSACCESS C:\MyTestDatabase\Test2.mdb", vbMaximizedFocus


I like the first one better because it seems as though opening Access
databases are seemless and are integrated into one application.

If you have any ideas. I would appreceate your comments and/or
solutions.

Thanks in advance.
j.t.w
 
D

david epsom dot com dot au

I think it would be because you have visible set to false.
What is the point of maximising an invisible application anyway?

(david)
 
J

j.t.w

David,

Thank for your response. You were right, .Visible needs to be set to
true before maximizing. I want to have .Visible set to false because I
don't want Access to "flicker".

I changed the code to...

Dim objAccess As Access.Application

Set objAccess = CreateObject("Access.Application")
With objAccess
.Visible = False
.OpenCurrentDatabase ("C:\MyTestDatabase\Test.mdb")
.Visible = True
.RunCommand acCmdAppMaximize
End With
Set objAccess = Nothing

DoCmd.Quit

And now it works like a champ.

Thanks for your help. I appreciate it.
j.t.w
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top