Solved

How to Maximise an Access form when MS Access application restores

Posted on 2014-02-08
4
787 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 26

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 26

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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

760 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

20 Experts available now in Live!

Get 1:1 Help Now