Solved

How to Maximise an Access form when MS Access application restores

Posted on 2014-02-08
4
851 Views
Last Modified: 2014-02-08
I am using the Access Window Manipulation code from http://access.mvps.org/access/api/api0019.htm to minimise an access window which contains a modular pop up form which maximise on open.

I have a button on the form to minimise the application of its onclick even :-
fSetAccessWindow(SW_SHOWMINIMIZED)

Everything works fine until I try to restore the application by click the access icon on the taskbar. The application restores but the form does not maximise.

I have experiment with an onclick event on the form to maximise it when click and that works but I'd prefer an event that triggers automatically when the aplication restores.

So the question is how do I programatically maximise an access form when the application restores.
0
Comment
Question by:Sheils
  • 2
  • 2
4 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39844560
Put DoCmd.Maximize after the call to fSetAccessWindow(SW_SHOWMAXIMIZED)
0
 
LVL 16

Author Comment

by:Sheils
ID: 39844564
Tried that, it does not change anything.
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39844607
Ok I see the problem.

Copy this to the form:
Private Sub Form_Resize()
    Me.TimerInterval = 1
End Sub

Private Sub Form_Timer()
    DoCmd.Maximize
    Me.TimerInterval = Empty
End Sub

Open in new window

0
 
LVL 16

Author Closing Comment

by:Sheils
ID: 39844696
That works like a charm. However, I made a little modification because I have an unbounded text box on the form that uses the ontimer event to display the time. This may be handy for viewers who want to this code but continue using the on timer event for other things. The modified code is as follows:

Private Sub Form_Resize()

'Set timer to 1 millisecong and the maximise boolean to true
Me.TimerInterval = 1
booMaximise = True

End Sub

Private Sub Form_Timer()

Me.txtClock = Now() 'Reset the clock textbox every second

If booMaximise = True Then 'Only run this code when booMaximise is true. True is set in the on Resize event

booMaximise = False 'Reset the booMaximise to false so that the clock will still run
DoCmd.Maximize 'Maximise the form
Me.TimerInterval = 1000 'Reset the time interval to 1 second

End If

End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now