[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-13
2
Medium Priority
?
519 Views
Last Modified: 2013-11-27
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

0
Comment
Question by:l-ipse
2 Comments
 
LVL 6

Accepted Solution

by:
matthewrhoades earned 500 total points
ID: 22954444
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

0
 

Author Closing Comment

by:l-ipse
ID: 31516556
It can't be as simple as that!

thank you
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

834 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