Need to maximize the access application window at the opening (not theform)

From a .NET 2003 application I open an Access application. I want the access application window to be maximize at the opening, but not the form.

I found this code but I don't know how to use it.

I put this code in a module, but I don't know how to point my AutoExec on it.

-------------------------------------------------------------------------------------------------------------------------
Public Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public Const SW_MAXIMIZE = 3


Put this call in the autoexec of the database to maximize:
(This is for a code module. If your autoexec macro doesn't call code, adjust this accordingly for a macro)

  Call ShowWindow(hWndAccessApp, SW_MAXIMIZE)
----------------------------------------------------------------------------------------------------------------------------

And if there's a way to do this in VB.NET that will be better.

Thank you very much
Function Open()
 
       
        Try
            Static acc As Microsoft.Office.Interop.Access.Application
 
            Dim db As dao.Database
 
            acc = New Microsoft.Office.Interop.Access.Application
 
            acc.Visible = True
            db = acc.DBEngine.OpenDatabase(m_cheminBase, False, False, ObtenirInfoConnexion(2))
            acc.OpenCurrentDatabase(m_cheminBase)
 
            db.Close()
            db = Nothing
 
        Catch ex As Exception
            MsgBox("Une erreur est survenue lors de l'ouverture de la base : " & ex.Message & " " & ex.Source)
        End Try
 
End Function

Open in new window

l-ipseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

matthewrhoadesCommented:
Try this:
Function Open()
 
       
        Try
            Static acc As Microsoft.Office.Interop.Access.Application
 
            Dim db As dao.Database
 
            acc = New Microsoft.Office.Interop.Access.Application
 
            acc.Visible = True
            acc.runCommand 10
            db = acc.DBEngine.OpenDatabase(m_cheminBase, False, False, ObtenirInfoConnexion(2))
            acc.OpenCurrentDatabase(m_cheminBase)
 
            db.Close()
            db = Nothing
 
        Catch ex As Exception
            MsgBox("Une erreur est survenue lors de l'ouverture de la base : " & ex.Message & " " & ex.Source)
        End Try
 
End Function

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
l-ipseAuthor Commented:
It can't be as simple as that!

thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.